Binary Converter
Type a number in binary, decimal, hex or octal to see it in every base at once, or switch to text mode to turn words into binary and back. Large numbers convert exactly.
How to use the binary converter
- Choose Numbers, type a value and pick the base it's in (binary, octal, decimal or hex). Prefixes like
0b,0oand0x, spaces and underscores are ignored. - Every other base appears instantly, with binary grouped in 4-bit nibbles.
- For negative numbers, the 8-, 16- and 32-bit two's complement forms are shown too.
- Choose Text → binary or Binary → text to encode letters as bytes and back.
How number bases work
Each position is worth a power of the base. In binary (base 2), positions are worth 1, 2, 4, 8, 16, and so on.
| Binary | Calculation | Decimal |
|---|---|---|
| 1 | 1 | 1 |
| 101 | 4 + 0 + 1 | 5 |
| 1010 | 8 + 0 + 2 + 0 | 10 |
| 1111 | 8 + 4 + 2 + 1 | 15 |
| 1 0000 | 16 | 16 |
| 1111 1111 | 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 | 255 |
Decimal to binary by hand: divide by 2 repeatedly and read the remainders from bottom to top. 13 → 6 r1 → 3 r0 → 1 r1 → 0 r1 = 1101.
Binary, hex and octal
| Decimal | Binary | Hex | Octal |
|---|---|---|---|
| 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 | 8 | 10 |
| 9 | 1001 | 9 | 11 |
| 10 | 1010 | A | 12 |
| 11 | 1011 | B | 13 |
| 12 | 1100 | C | 14 |
| 13 | 1101 | D | 15 |
| 14 | 1110 | E | 16 |
| 15 | 1111 | F | 17 |
One hex digit is exactly four bits, so hex is a compact way to write binary: 1111 1111 = FF = 255. One octal digit is three bits.
Two's complement (negative numbers)
Computers usually store signed integers in two's complement: flip every bit of the positive value and add 1. In 8 bits, −5 is 1111 1011. An 8-bit signed value ranges from −128 to 127; 16 bits from −32,768 to 32,767.
Text to binary
Text is stored as bytes using an encoding; this converter uses UTF-8, the web's standard. English letters, digits and punctuation take one byte each ("A" = 01000001, "a" = 01100001), while accented letters take two bytes and emoji four.
Frequently asked questions
What is 255 in binary?
1111 1111, which is FF in hex and 377 in octal: the largest value that fits in one byte (8 bits).
How do I convert hex to binary?
Replace each hex digit with its four-bit pattern: 2F = 0010 1111. Or type the hex value here and choose Hexadecimal.
Can it convert very large numbers?
Yes. It uses arbitrary-precision integers, so numbers with dozens of digits convert exactly.
Why does my text become more than 8 bits per character?
Characters outside basic English (é, ñ, emoji) use two to four bytes in UTF-8.