How number bases work
A base-b number system uses b digits and place values that
are powers of b. Binary (base 2) uses digits 0–1, octal (base 8) uses
0–7, decimal uses 0–9, and hexadecimal (base 16) extends to the letters A–F,
where A = 10 and F = 15. The same quantity just wears
different clothes: 255, FF, 377, and
1111 1111 are all one value.
Digits 0–15 in each base
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
Two's complement
Computers store signed integers as two's complement: to negate a number,
invert every bit and add one. In an 8-bit register, 1111 1111
is −1 and 1000 0000 is −128. Switch the mode selector above
to a width and the converter shows exactly what a CPU register of that size
would hold — the bit pattern in binary/octal/hex, the signed value in
decimal.
Popular conversions
Hex to binary · binary to hex · hex to decimal · decimal to hex · binary to decimal · decimal to binary · octal to decimal · decimal to octal · binary to octal · octal to binary · hex to octal · octal to hex
Frequently asked questions
- Why does the bit grid sometimes disappear?
- In unsigned mode it's shown for non-negative values up to 64 bits. Larger numbers still convert exactly — there's just no sensible fixed-width register view for them. Pick a two's complement width for a fixed grid.
- What does the Text mode do?
- Set From to Text and each character of what you type is shown as its
UTF-8 byte value in every base —
Hibecomes hex48 69, binary01001000 01101001. Set To to Text to go the other way: a number's bytes are decoded back into characters. - Does 0x or 0b work in the input?
- Here, no — the From dropdown sets the base explicitly. Prefixed literals
like
0xFFshine in the programmer's calculator, where you can mix bases inside one expression.