UtilHero

Number Base Converter

Convert between binary, octal, decimal, and hexadecimal.

Input base
Binary11111111
Octal377
Decimal255
Hexadecimalff

About Number Base Converter

A number base converter changes a number between binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Enter a value and pick its base — the converter shows the equivalent in every other base at once, so it does hex to decimal, binary to decimal, decimal to binary, binary to hex, and any other pair. It uses big-integer math, so even very large numbers convert exactly.

What a base actually means

A base is how many distinct digits you count with before adding a column. Decimal has ten, so after 9 you carry. Binary has two, hexadecimal sixteen — which is why hex borrows letters, with A through F standing for ten through fifteen. The number itself never changes; only the notation does. The value written as 255 in decimal, FF in hex, and 11111111 in binary is one quantity described three ways.

Reading any base works the same way: each column is the base raised to its position. So hex 2F is 2 × 16 + 15 = 47, and binary 1011 is 8 + 0 + 2 + 1 = 11. Once that clicks, converting by hand stops being memorisation and becomes arithmetic.

Why hexadecimal exists

Hex is popular because sixteen is two to the fourth, so exactly four binary digits map to one hex digit with no arithmetic at all. 1111 is F, 1010 is A, every time, regardless of position. That makes hex a compact shorthand for binary that a person can read aloud, which is why memory addresses, colour codes, and byte dumps all use it.

It also makes conversion between binary and hex a lookup rather than a calculation. Group the binary digits in fours from the right, translate each group, done. Octal has the same relationship with groups of three bits, which is why it survives in Unix file permissions — each octal digit is exactly the read, write, and execute bits for one class of user.

Where large numbers break

Most languages store numbers as 64-bit doubles, which represent integers exactly only up to 2 to the 53, about 9 quadrillion. Past that, conversions start returning values that are close but wrong — the last few digits drift. This bites when converting long hexadecimal identifiers, 64-bit hashes, or database keys, exactly the cases where being off by one is worst.

This converter uses big-integer arithmetic, so digits are carried exactly however long the number is. If you are doing the same conversion in code, use your language's arbitrary-precision integer type for anything longer than about fifteen digits rather than trusting the default numeric type.

Prefixes and common confusions

Most languages mark the base with a prefix: 0x for hex, 0b for binary, 0o for octal. A bare leading zero means octal in C and several older languages, which is a genuine hazard — writing 0755 and 755 gives two different numbers, and a zero-padded value like 08 is a syntax error in octal because there is no digit 8.

The other frequent confusion is treating a hex string as text rather than a number. The colour value FF0000 and the number 16711680 are the same quantity, but a text field storing the first cannot be compared or sorted numerically. Convert at the boundary — parse to a number when it enters your system, format back to hex when you display it.

Frequently asked questions

How do I convert hex to decimal?
Enter the hexadecimal number, set the input base to Hexadecimal, and read the Decimal row. For example, FF in hex is 255 in decimal. Every other base is shown at the same time.
How do I convert binary to decimal?
Enter the binary number and set the input base to Binary — the Decimal row shows the result instantly. For example, 1010 in binary is 10 in decimal.
How do I convert decimal to binary?
Enter the decimal number with the input base set to Decimal, then read the Binary row. For example, 255 in decimal is 11111111 in binary. The octal and hex equivalents appear at the same time.
Does it handle very large numbers?
Yes. Conversion uses arbitrary-precision integers, so numbers far larger than a normal 64-bit value stay exact — no rounding or lost digits.
What characters are allowed for each base?
Binary uses 0–1, octal 0–7, decimal 0–9, and hexadecimal 0–9 and A–F (case doesn't matter). Anything outside the chosen base's digits is flagged as invalid.