🔢 Number Base Converter

Convert a number between binary, octal, decimal, hexadecimal and any base from 2 to 36, with the place-value breakdown shown so you can follow the arithmetic.

Digits 0–9 and letters A–Z, matching the input base below.

Binary, hex and everything between

A number base is how many distinct digits a system uses before it rolls over into a new column. Decimal uses ten, binary two, hexadecimal sixteen. The number itself does not change when you convert; only the notation does. Eleven objects are eleven objects whether you write 11, 1011 or B.

Place value

Every positional system works the same way: each column is the base raised to a power, counting from zero on the right.

10112 = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = 11

2F16 = 2×16¹ + 15×16⁰ = 32 + 15 = 47

Beyond base ten, letters stand in for the extra digits: A is 10, B is 11, through to Z as 35 in base 36. That is why hexadecimal runs 0 to 9 then A to F.

The common bases and why each exists

Where each base is used
BaseNameDigitsUsed for
2Binary0–1How computers physically store everything
8Octal0–7Unix file permissions, older systems
10Decimal0–9Human counting, ten fingers
16Hexadecimal0–9, A–FMemory addresses, colour codes, byte values
36Base 360–9, A–ZShort identifiers and URL slugs

Why hexadecimal and not something else

Because sixteen is two to the fourth, each hex digit maps to exactly four binary digits with no remainder. That makes conversion between the two purely mechanical: split the binary into groups of four from the right and convert each group independently. 11111101010 becomes 0111 1110 1010, which is 7EA.

A byte is eight bits, which is exactly two hex digits, so any byte value fits in the range 00 to FF. This is why colour codes look like #FF8800: three bytes, one each for red, green and blue, written as six hex digits.

Octal survives mainly in Unix file permissions, where each digit encodes read, write and execute as 4, 2 and 1. Permission 755 means 7 (read, write, execute) for the owner, 5 (read and execute) for the group and 5 for everyone else.

Converting by hand

To decimal: multiply each digit by the base raised to its position and add. From decimal: divide repeatedly by the target base, writing down the remainders, then read them bottom to top. Converting 26 to binary: 26/2 = 13 r0, 13/2 = 6 r1, 6/2 = 3 r0, 3/2 = 1 r1, 1/2 = 0 r1. Reading upwards gives 11010.

Bits, bytes and what they hold

How many values fit in n bits
BitsValuesUnsigned rangeCommon use
82560–255One byte, a colour channel
1665,5360–65,535Unicode basic plane, older integers
324.29 billion0–4,294,967,295IPv4 addresses, standard integers
641.84 × 10¹⁹0 to about 1.8 × 10¹⁹Modern integers, timestamps

The 32-bit limit is why IPv4 ran out of addresses, and why the Unix timestamp overflows in January 2038 on systems still using a signed 32-bit integer for seconds since 1970.

A worked example

Convert 2,026 to binary and hexadecimal. Dividing repeatedly by two gives 11111101010, eleven bits. Grouping from the right into fours, 0111 1110 1010, gives 7EA in hex. Checking: 7×256 + 14×16 + 10 = 1,792 + 224 + 10 = 2,026.

Frequently Asked Questions (FAQs)

Why do computers use binary?

Because a transistor is reliably either on or off, and distinguishing two states is far more robust than distinguishing ten voltage levels. Everything above binary, including hexadecimal, exists purely for human convenience when reading what the machine stores.

What is hexadecimal used for?

Memory addresses, byte values, colour codes and hash digests. Its advantage is that each hex digit is exactly four bits, so it represents binary compactly without any awkward arithmetic to convert between them.

How do I convert binary to hexadecimal quickly?

Group the binary digits into fours starting from the right, padding the leftmost group with zeros, then convert each group independently. 11111101010 becomes 0111 1110 1010, which is 7, E, A, so 7EA.

What is base 36 for?

Short alphanumeric identifiers. Using all ten digits and all 26 letters packs more information into fewer characters than decimal, which is why URL shorteners and some database keys use it. A six-character base 36 string covers over two billion values.

Why is a byte 256 values?

Because it is eight bits and each bit has two states, giving 2⁸ = 256 combinations, numbered 0 to 255. Eight bits became standard because it conveniently holds one character in early encodings and divides neatly into hexadecimal.

What does 0x mean in front of a number?

It is a prefix marking the number as hexadecimal, used in C and most languages derived from it. Similarly 0b marks binary and a leading 0 or 0o marks octal. Without the prefix, 10 is ambiguous across bases.