HomeText & Developer Tools › Number Base Converter

Number Base Converter

Convert a number between binary, octal, decimal, hexadecimal and any custom base from 2 to 36, with exact big-integer arithmetic and negative number support.

What a base actually means

Positional notation means a digit's value depends on its place. In base 10 the number 255 is 2x100 + 5x10 + 5x1. In base 16 the same value is written FF, because F is the digit for fifteen and FF is 15x16 + 15 = 255. In base 2 it is 11111111, eight ones, each place worth twice the one to its right. Converting from any base to decimal is the same repeated step: start at zero, and for each digit multiply the running total by the base and add the digit's value. Converting the other way divides repeatedly by the target base and reads the remainders backwards.

Bases above 10 need extra digits, and the universal convention borrows letters: a = 10, b = 11, up to z = 35, which is why 36 is the practical maximum. Base 36 is how short URL slugs and some license keys pack a large number into few characters - the decimal 1,000,000 is just RS4W in base 36. Base 62 and base 64 exist too, but they need both cases of the alphabet, so they are not part of the standard 2-36 range.

Where each base shows up

Binary is what hardware stores, and it matters whenever you work with bit flags, network masks or file permissions. Octal groups bits in threes and survives mainly in Unix file modes, where 755 means rwxr-xr-x - three octal digits map perfectly onto three permission bits each. Hexadecimal groups bits in fours, so one hex digit is exactly one nibble and one byte is exactly two hex characters; that is why memory dumps, MAC addresses, CSS colors (#FF8800) and hash digests are all written in hex.

A conversion worth memorizing: 255 = FF = 11111111 = one byte at maximum, and 65535 = FFFF = two bytes. A color like #1E90FF is three bytes, 30/144/255 in decimal. An IPv4 address is four bytes, which is why 192.168.1.10 is C0A8010A in hex. This page prints the binary form grouped into nibbles so you can line it up against hex by eye.

Precision, prefixes and negatives

JavaScript numbers are 64-bit floats and only represent integers exactly up to 9,007,199,254,740,991 (2^53 - 1). That is not enough for a 64-bit hash, a Snowflake ID or a long hex key, so this converter uses BigInt when the browser provides it, which every current browser does. With BigInt the arithmetic is exact no matter how many digits you paste - a 256-bit SHA-256 digest converts to decimal without rounding. If BigInt is missing, the note under the table says so.

The converter accepts the usual source prefixes - 0x for hex, 0b for binary, 0o for octal - and ignores spaces, underscores and commas, so you can paste 1111_0000 or DE AD BE EF directly. Negative values are handled with a plain minus sign in front of the magnitude, which is how humans write them. That is not the same as two's complement, the fixed-width representation a CPU uses: in 8-bit two's complement, -1 is stored as 11111111, the same bit pattern as 255. If you need two's complement, add 2^n to the negative value first, then convert.

Frequently asked questions

What is 255 in hexadecimal and binary?

FF and 11111111. That is the largest value one byte can hold, which is why color channels, IPv4 octets and many protocol fields all stop at 255.

Can it handle very large numbers?

Yes. The converter uses BigInt where the browser supports it, so a 64-bit ID or a 64-character hex digest converts exactly, with no floating-point rounding.

Why does base 36 stop at the letter z?

Because 10 digits plus 26 letters gives 36 symbols. Going further requires distinguishing uppercase from lowercase, which produces base 62 or base 64 - different schemes with their own alphabets.

How do I convert negative numbers in two's complement?

Add 2 raised to the bit width to the negative value, then convert the result. For 8 bits, -5 becomes 256 - 5 = 251 = FB = 11111011.