How to use the binary converter
Type the number, choose the base it is written in, and press Convert. You get the same value in binary, decimal, octal and hexadecimal, each with a copy button, plus the number of bits it needs, the binary padded to whole bytes in groups of four, and — for decimal, octal and hex input — the divide-by-2 table that produces the binary digits.
Place values in base 2
Decimal digits count ones, tens, hundreds and thousands. Binary digits (bits) count powers of 2 instead: from the right, 1, 2, 4, 8, 16, 32, 64, 128. A bit is either 0 or 1, so a binary number is simply a list of which powers of 2 to add. 11111111 has all eight bits set: 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255, the largest value a byte (8 bits) can hold. A number needs one more bit each time it passes a power of 2 — 256 is the first 9-bit number.
Decimal to binary: divide by 2
Divide the number by 2, write down the remainder (0 or 1), and repeat with the quotient until it reaches 0. The remainders read from last to first are the binary digits. For 37:
- 37 ÷ 2 = 18 remainder 1
- 18 ÷ 2 = 9 remainder 0
- 9 ÷ 2 = 4 remainder 1
- 4 ÷ 2 = 2 remainder 0
- 2 ÷ 2 = 1 remainder 0
- 1 ÷ 2 = 0 remainder 1
Reading upward gives 100101. Check: 32 + 4 + 1 = 37.
Binary to decimal
Add the place values of the bits that are 1. For 100101, the 1s sit in the 32, 4 and 1 positions: 32 + 4 + 1 = 37.
Hexadecimal and binary: one hex digit per four bits
Hexadecimal (base 16) uses the digits 0–9 and the letters A–F for 10–15. Because 16 = 2⁴, every hex digit stands for exactly four bits, which makes converting between the two a matter of looking up groups:
| Hex | Binary | Hex | Binary | Hex | Binary | Hex | Binary |
|---|---|---|---|---|---|---|---|
| 0 | 0000 | 4 | 0100 | 8 | 1000 | C | 1100 |
| 1 | 0001 | 5 | 0101 | 9 | 1001 | D | 1101 |
| 2 | 0010 | 6 | 0110 | A | 1010 | E | 1110 |
| 3 | 0011 | 7 | 0111 | B | 1011 | F | 1111 |
So 1FF in hex is 0001 1111 1111 in binary, and 1010 0110 in binary is A6 in hex. A byte is always exactly two hex digits (00 to FF), which is why programmers prefer hex to long strings of bits: memory addresses, color codes like #FF8800 (red FF, green 88, blue 00), MAC addresses and file dumps are all written in hex.
Octal: three bits per digit
Octal (base 8) uses the digits 0–7, and each one stands for three bits. 777 in octal is 111 111 111 in binary — 511 in decimal and 1FF in hex. Octal survives mainly in Unix file permissions, where each digit holds the read, write and execute bits for one group: chmod 755 means 111 101 101, or rwxr-xr-x.
Worked example: FF in every base
FF (hex) → each F is 1111, so the binary is 11111111. Adding the place values gives 255 in decimal. Grouping the same bits in threes from the right, 011 111 111, gives 377 in octal. The number uses 8 bits, exactly one byte.
Frequently asked questions
How do I write a negative number in binary?
Computers use two's complement inside a fixed width: flip every bit of the absolute value and add 1. In 8 bits, −1 is 11111111 and −128 is 10000000 — the same bit patterns as 255 and 128 unsigned, so the width and the convention must be agreed in advance. This converter handles non-negative whole numbers only.
Can I convert a fraction or decimal point to binary?
Not with this tool. Fractions use negative powers of 2 after a binary point (0.1 in binary = 1/2, 0.01 = 1/4), and many decimal fractions never terminate in binary — 0.1 in decimal is 0.000110011… — which is why 0.1 + 0.2 is not exactly 0.3 in floating-point arithmetic.
What is the largest number that fits in 8, 16, 32 or 64 bits?
2 to the power of the width, minus 1: 255 for 8 bits, 65,535 for 16, 4,294,967,295 for 32 and 18,446,744,073,709,551,615 for 64.
What do the 0b, 0o and 0x prefixes mean?
They mark the base in most programming languages: 0b for binary, 0o for octal and 0x for hexadecimal, so 0b11111111, 0o377, 0xFF and 255 are the same value. The converter accepts and strips the prefix that matches the base you selected.
How many bits does a number need?
Find the largest power of 2 that is not bigger than the number and add 1 to its exponent: 255 is less than 2⁸ = 256, so it fits in 8 bits; 256 needs 9. The Bits row shows this count, and Bytes rounds it up to whole bytes of 8.
Last updated: October 9, 2026