How base conversion works
A number system's base (or radix) is how many digits it has. Decimal has ten (0–9), binary two (0 and 1), octal eight and hexadecimal sixteen (0–9 then A–F). The value of a written number is the sum of each digit multiplied by the base raised to the digit's position, counting from zero on the right.
So 1011 in binary is 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = 11, and FF in hex is 15×16¹ + 15×16⁰ = 240 + 15 = 255.
Converting from decimal to another base
- Divide the number by the target base and write down the remainder.
- Divide the quotient again, and keep going until the quotient is 0.
- Read the remainders from last to first. That is the number in the new base.
For 11 → binary: 11 ÷ 2 = 5 r 1, 5 ÷ 2 = 2 r 1, 2 ÷ 2 = 1 r 0, 1 ÷ 2 = 0 r 1. Reading upward: 1011. The converter above prints these steps for any number you enter.
Hex and binary are the same thing in disguise
Because 16 = 2⁴, every hex digit is exactly four binary digits (a nibble). To convert between them, replace each hex digit with its 4-bit pattern and vice versa. 0xBEEF = 1011 1110 1110 1111. Octal works the same way with groups of three bits. That is why programmers prefer hex: it is a compact way to write bit patterns.
| Hex | Binary | Dec | Hex | Binary | Dec |
|---|---|---|---|---|---|
| 0 | 0000 | 0 | 8 | 1000 | 8 |
| 1 | 0001 | 1 | 9 | 1001 | 9 |
| 2 | 0010 | 2 | A | 1010 | 10 |
| 3 | 0011 | 3 | B | 1011 | 11 |
| 4 | 0100 | 4 | C | 1100 | 12 |
| 5 | 0101 | 5 | D | 1101 | 13 |
| 6 | 0110 | 6 | E | 1110 | 14 |
| 7 | 0111 | 7 | F | 1111 | 15 |
Prefixes you will see in code
Most languages mark the base with a prefix: 0x1F for hex, 0b11111 for binary, 0o37 (or a leading 0 in C) for octal. This converter accepts all of them, and also ignores spaces, underscores and commas, so 1111_1111 and 1111 1111 both work.
Examples
Questions
How do I convert binary to hex?
Group the bits in fours from the right, padding the leftmost group with zeros, then replace each group with a hex digit. 11011110 → 1101 1110 → DE.
What is 1111 in hex?
1111 in binary is F in hex (15 in decimal).
Why do programmers use hexadecimal?
One hex digit is exactly four bits, so a byte is always two hex digits. Memory addresses, colour codes, hashes and bit flags are easier to read and type as hex than as long binary strings, while the mapping to bits stays obvious.
Does this converter handle big numbers?
Yes. It uses arbitrary-precision integers, so values beyond 64 bits (for example 256-bit hashes written as decimal) are converted exactly, with no rounding.
Is my input sent to a server?
No. The conversion runs in your browser. The site has no backend that receives your numbers.