Every photo, message and program on your device is ultimately stored as long rows of 0s and 1s. That sounds alien, but binary is just a number system with two digits instead of ten. If you understand why 352 means “three hundreds, five tens and two ones”, you already understand binary. This guide shows how to read binary, convert numbers both ways by hand, and turn text into binary the way computers do. To check your work, paste the result into our binary translator.
Why computers use binary
Electronic circuits are most reliable when they only need to tell two states apart: voltage high or low, a transistor on or off, a magnetic region pointing one way or the other. A system with ten voltage levels would be far more sensitive to noise. Two states map perfectly to the digits 1 and 0, and with enough of them you can represent anything.
- 1 bit = one binary digit: 2 possible values.
- 8 bits = 1 byte: 2^8 = 256 values (0 to 255).
- 16 bits: 65,536 values. 32 bits: about 4.29 billion values.
Each extra bit doubles the number of combinations. That is also why memory sizes favour powers of two, and why “kilo” in computing once meant 1024; see our guide to data storage units for how that still causes confusion.
Place values: reading a binary number
In decimal, each position is worth ten times the one to its right: 1, 10, 100, 1000. In binary, each position is worth two times the one to its right:
| Position (from right) | 8th | 7th | 6th | 5th | 4th | 3rd | 2nd | 1st |
|---|---|---|---|---|---|---|---|---|
| Power of 2 | 2^7 | 2^6 | 2^5 | 2^4 | 2^3 | 2^2 | 2^1 | 2^0 |
| Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Binary to decimal by hand
Write the place values under the digits, then add the values wherever there is a 1.
Example: 1101
digit: 1 1 0 1
value: 8 4 2 1
sum: 8 + 4 + 0 + 1 = 13
Example: 10011100
digit: 1 0 0 1 1 1 0 0
value: 128 64 32 16 8 4 2 1
sum: 128 + 16 + 8 + 4 = 156
A quick sanity check: a binary number ending in 0 is even, one ending in 1 is odd.
Decimal to binary by hand
There are two reliable methods.
Method 1: divide by 2
Divide the number by 2 repeatedly and write down the remainders. Read the remainders from bottom to top.
Example: 156
156 ÷ 2 = 78 remainder 0
78 ÷ 2 = 39 remainder 0
39 ÷ 2 = 19 remainder 1
19 ÷ 2 = 9 remainder 1
9 ÷ 2 = 4 remainder 1
4 ÷ 2 = 2 remainder 0
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1
Reading upwards: 10011100, which matches the example above.
Method 2: subtract the largest power of 2
Find the biggest place value that fits, write 1, subtract, and continue. For 42: 32 fits (remainder 10), 16 does not (0), 8 fits (remainder 2), 4 does not (0), 2 fits (remainder 0), 1 does not (0). Result: 101010.
| Decimal | Binary | Hex |
|---|---|---|
| 13 | 1101 | D |
| 42 | 101010 | 2A |
| 100 | 1100100 | 64 |
| 156 | 10011100 | 9C |
| 255 | 11111111 | FF |
| 256 | 100000000 | 100 |
| 2026 | 11111101010 | 7EA |
Text to binary: ASCII and UTF-8
Computers store text by giving every character a number. The classic table is ASCII, which covers 128 characters: English letters, digits, punctuation and control codes. Each ASCII code fits in one byte, written as 8 binary digits.
| Character | Decimal | Binary | Hex |
|---|---|---|---|
| space | 32 | 00100000 | 20 |
| 0 | 48 | 00110000 | 30 |
| A | 65 | 01000001 | 41 |
| H | 72 | 01001000 | 48 |
| a | 97 | 01100001 | 61 |
| i | 105 | 01101001 | 69 |
To translate a word:
- Look up each character’s code: H = 72, i = 105.
- Convert each code to binary and pad it to 8 digits: 72 = 1001000 → 01001000, 105 = 1101001 → 01101001.
- Write the bytes in order: “Hi” = 01001000 01101001.
To go back, split the binary into groups of 8, convert each group to decimal and look up the character. A handy pattern: uppercase letters start with 010, lowercase with 011, so “A” (65) and “a” (97) differ by exactly 32, a single bit.
Beyond English: UTF-8
ASCII has no room for é, ñ, emoji or non-Latin scripts. Today almost all web text uses UTF-8, which keeps ASCII characters as single bytes and encodes everything else in 2 to 4 bytes:
| Character | Unicode | UTF-8 bytes (binary) |
|---|---|---|
| é | U+00E9 | 11000011 10101001 |
| € | U+20AC | 11100010 10000010 10101100 |
| 😀 | U+1F600 | 11110000 10011111 10011000 10000000 |
The first bits of each byte tell a decoder how many bytes belong together (110… starts a 2-byte character, 1110… a 3-byte one, 11110… a 4-byte one, and 10… marks a continuation byte). This is why “é” is two bytes even though it looks like one letter.
Hexadecimal: binary shorthand
Long binary strings are hard to read, so programmers use hexadecimal (base 16, digits 0–9 and A–F). One hex digit represents exactly 4 bits, so one byte is always two hex digits.
binary: 1001 1100
hex: 9 C → 0x9C = 156
You see hex in colour codes (#FF0000 is red: FF = 255 for red, 00 for green and blue), MAC addresses and memory dumps. Base64, another way of writing binary data as text, packs 6 bits per character instead; our Base64 encoder shows it in action, and the Base64 and URL encoding guide explains when it is used.
Common mistakes
- Reading the division remainders from top to bottom instead of bottom to top.
- Forgetting leading zeros: “H” is 01001000, not 1001000, when you write bytes for text.
- Assuming every character is one byte. Only ASCII characters are; accented letters and emoji take more in UTF-8.
- Mixing up the value of a bit position: the rightmost digit is worth 1 (2^0), not 2.
- Treating binary or Base64 as encryption. Anyone can decode them.