The binary number system
Binary is the base-2 number system: every number is written with just 0 and 1. Here is how to read binary numbers, how to count in binary, and a binary chart to check your work.
Prefixes 0b, 0o, 0x and spaces or underscores between digits are fine. A point starts the fraction.
How does the binary number system work?
Decimal, the system we use every day, has ten digits and each place is worth ten times the place to its right. Binary has two digits, 0 and 1, and each place is worth two times the place to its right. So the places in a binary number are worth 1, 2, 4, 8, 16, 32, 64, 128 and so on, from right to left.
How do you read binary numbers?
- Write the place values over the digits, starting with 1 on the right and doubling to the left.
- Keep the place values that sit over a 1, and ignore the ones over a 0.
- Add them up.
For 101101 the 1s sit in the 32, 8, 4 and 1 places, so the number is 32 + 8 + 4 + 1 = 45.
| Digit | Place value | Digit × place value |
|---|---|---|
| 1 | 25 = 32 | 32 |
| 0 | 24 = 16 | 0 |
| 1 | 23 = 8 | 8 |
| 1 | 22 = 4 | 4 |
| 0 | 21 = 2 | 0 |
| 1 | 20 = 1 | 1 |
Counting in binary
Counting starts 0, 1, and then the ones place runs out of digits. It goes back to 0 and carries 1 into the next place, giving 10, which is two. Then 11 (three), 100 (four), 101, 110, 111, 1000 (eight). Every time a number is all 1s, the next number is a 1 followed by zeros, and it is a power of 2.
A quick check: with n bits you can count from 0 up to 2n − 1. Four bits go up to 1111, which is 15; eight bits go up to 11111111, which is 255.
Binary chart: 0 to 32
| Decimal | Binary | 8-bit binary |
|---|---|---|
| 0 | 0 | 00000000 |
| 1 | 1 | 00000001 |
| 2 | 10 | 00000010 |
| 3 | 11 | 00000011 |
| 4 | 100 | 00000100 |
| 5 | 101 | 00000101 |
| 6 | 110 | 00000110 |
| 7 | 111 | 00000111 |
| 8 | 1000 | 00001000 |
| 9 | 1001 | 00001001 |
| 10 | 1010 | 00001010 |
| 11 | 1011 | 00001011 |
| 12 | 1100 | 00001100 |
| 13 | 1101 | 00001101 |
| 14 | 1110 | 00001110 |
| 15 | 1111 | 00001111 |
| 16 | 10000 | 00010000 |
| 17 | 10001 | 00010001 |
| 18 | 10010 | 00010010 |
| 19 | 10011 | 00010011 |
| 20 | 10100 | 00010100 |
| 21 | 10101 | 00010101 |
| 22 | 10110 | 00010110 |
| 23 | 10111 | 00010111 |
| 24 | 11000 | 00011000 |
| 25 | 11001 | 00011001 |
| 26 | 11010 | 00011010 |
| 27 | 11011 | 00011011 |
| 28 | 11100 | 00011100 |
| 29 | 11101 | 00011101 |
| 30 | 11110 | 00011110 |
| 31 | 11111 | 00011111 |
| 32 | 100000 | 00100000 |
The full chart for one byte, 0 to 255 with hex, octal and signed values, is on the binary numbers 0 to 255 page.
Writing other numbers in binary
- From decimal: divide by 2 again and again and read the remainders from the bottom up. The decimal to binary converter shows every step.
- Negative numbers: computers use two’s complement, where the leftmost bit counts as negative.
- Fractions: places to the right of the point are worth ½, ¼, ⅛ and so on, so 0.101 in binary is ½ + ⅛ = 0.625.
- Shorter forms: group the bits in fours for hexadecimal, or in threes for octal.
- One bit at a time: Gray code orders numbers so that each one differs from the next in a single bit.
To practise reading and writing binary, print a set of binary worksheets with answer keys.
Sources and method
- W3C WebAssembly Core Specification, overview: integers are read as unsigned or as signed in two’s complement representation. Checked 2026-11-25.
Conversions use exact whole-number arithmetic (JavaScript BigInt), so long numbers keep every digit. Fractions are kept as exact ratios; when the digits repeat, the repeating block is found and marked instead of rounded.
Questions
What is 10 in binary?
1010: one 8 and one 2.
Why do computers use the binary number system?
Their circuits store and switch between two states, and two states are the easiest to tell apart reliably. Each state is a bit: 0 or 1.
How do you read a binary number quickly?
Learn the place values 128, 64, 32, 16, 8, 4, 2, 1 for one byte. Then add the ones that sit over a 1.
Is binary the same as base 2?
Yes. The binary number system is the base-2 number system.