Text and binary: what a binary translator actually does
When people ask to convert text to binary, they are asking for two steps at once. First each character becomes a number — its character code — and then that number becomes binary. The letter A is character code 65, and 65 in binary is 01000001. Nothing about the letter A is inherently binary; the number in between is doing the work.
That intermediate number comes from an encoding standard. ASCII, defined in the 1960s, covers 128 characters — the English alphabet in both cases, digits, punctuation and some control codes — which fits in seven bits, conventionally padded to eight. UTF-8 extends this to every character in Unicode while keeping the first 128 identical to ASCII, which is why plain English text is byte-for-byte the same in both. Characters beyond that range, including accented letters and emoji, use two to four bytes in UTF-8.
This is why a binary translator needs an encoding setting and why results differ between tools that do not have one. It is also why binary text is conventionally written in groups of eight separated by spaces: each group is one byte, which is one character in ASCII. Strip the spaces and the string is still valid, but a human can no longer see where one character ends and the next begins.
Worked example: the word Hello
Take each letter in turn. H is 72, e is 101, l is 108, l is 108 again, and o is 111. Convert each to eight bits and you get 01001000 01100101 01101100 01101100 01101111. Five characters, five bytes, forty bits. Reversing the process means splitting the string into groups of eight, converting each back to a number, and looking the number up as a character.
How binary works as a number system
Binary is base 2, so it uses only 0 and 1, and every place is worth twice the one to its right: 1, 2, 4, 8, 16, 32 and onward. Decimal 10 is written 1010 in binary because it is one eight, no fours, one two and no ones.
Computers use binary because a physical component can reliably hold two states — charged or not, high voltage or low — but distinguishing ten distinct voltage levels reliably is far harder. Everything above that layer is convention built on the same two symbols. It is also why powers of two appear everywhere in computing: 256, 1024, 65536 are round numbers in binary even though they look arbitrary in decimal.
| Power | Value | Binary | Where it shows up |
| 2^0 | 1 | 1 | Least significant bit |
| 2^1 | 2 | 10 | |
| 2^2 | 4 | 100 | |
| 2^3 | 8 | 1000 | One nibble of range |
| 2^4 | 16 | 10000 | Hex digit ceiling |
| 2^5 | 32 | 100000 | ASCII space |
| 2^6 | 64 | 1000000 | |
| 2^7 | 128 | 10000000 | Signed byte boundary |
| 2^8 | 256 | 100000000 | One byte of range |
| 2^9 | 512 | 1000000000 | |
| 2^10 | 1024 | 10000000000 | One kibibyte |
| 2^11 | 2048 | 100000000000 | |
| 2^12 | 4096 | 1000000000000 | Memory page |
| 2^13 | 8192 | 10000000000000 | |
| 2^14 | 16384 | 100000000000000 | |
| 2^15 | 32768 | 1000000000000000 | Signed 16-bit boundary |
| 2^16 | 65536 | 10000000000000000 | Port number ceiling |
| 2^20 | 1048576 | (21 bits) | One mebibyte |
| 2^24 | 16777216 | (25 bits) | 24-bit colour range |
| 2^31 | 2147483648 | (32 bits) | Signed 32-bit boundary |
| 2^32 | 4294967296 | (33 bits) | Unsigned 32-bit range |
Converting decimal to binary by hand
- Divide the decimal number by 2.
- Write down the quotient and the remainder — the remainder is always 0 or 1.
- Replace the number with the quotient and repeat.
- Stop when the quotient reaches 0.
- Read the remainders from the bottom up. That is your binary number.
For 10: 10 divided by 2 is 5 remainder 0; 5 divided by 2 is 2 remainder 1; 2 divided by 2 is 1 remainder 0; 1 divided by 2 is 0 remainder 1. Reading bottom-to-top gives 1010. Going the other way is easier — write the place values above the bits and add up the ones. For 1010: 8 + 0 + 2 + 0 = 10.
| Step | Division | Quotient | Remainder |
| 1 | 10 / 2 | 5 | 0 |
| 2 | 5 / 2 | 2 | 1 |
| 3 | 2 / 2 | 1 | 0 |
| 4 | 1 / 2 | 0 | 1 |
The working panel on the converter above generates this same table live for any number you type.
Negative numbers and two's complement
Binary has no minus sign. Negative values are stored using two's complement, which means the answer depends entirely on how many bits you are working in — so there is no single binary pattern that means 'negative five' without stating the width first.
The rule: to represent a negative number in a given width, add it to two raised to that width. For -5 in 8 bits, 256 - 5 = 251, which is 11111011. In 16 bits it is 1111111111111011. The giveaway is the leading bit — in a signed value, a top bit of 1 always means negative. This is also why an 8-bit signed value only reaches 127 upward but -128 downward: the patterns are not symmetrical.
| Decimal | 8-bit binary | 8-bit hex | 16-bit binary |
| 127 | 01111111 | 7F | 0000000001111111 |
| 1 | 00000001 | 01 | 0000000000000001 |
| 0 | 00000000 | 00 | 0000000000000000 |
| -1 | 11111111 | FF | 1111111111111111 |
| -2 | 11111110 | FE | 1111111111111110 |
| -5 | 11111011 | FB | 1111111111111011 |
| -10 | 11110110 | F6 | 1111111111110110 |
| -16 | 11110000 | F0 | 1111111111110000 |
| -32 | 11100000 | E0 | 1111111111100000 |
| -64 | 11000000 | C0 | 1111111111000000 |
| -100 | 10011100 | 9C | 1111111110011100 |
| -127 | 10000001 | 81 | 1111111110000001 |
| -128 | 10000000 | 80 | 1111111110000000 |
Binary fractions and why 0.1 is a problem
Bits after a binary point are negative powers of two: the first is a half, the second a quarter, the third an eighth. So 0.11 in binary is a half plus a quarter, or 0.75, and 0.101 is a half plus an eighth, or 0.625.
The catch is that many ordinary decimal fractions have no exact binary representation. 0.1 is the famous one — in binary it repeats forever as 0.000110011001100..., in the same way one third repeats in decimal. Computers store a truncated approximation, which is why 0.1 + 0.2 does not equal 0.3 in most programming languages. That behaviour surprises people constantly, and it is a direct consequence of the arithmetic in this table rather than a bug.
| Binary | Decimal | Fraction | Exact? |
| 0.1 | 0.5 | 1/2 | Yes |
| 0.01 | 0.25 | 1/4 | Yes |
| 0.11 | 0.75 | 3/4 | Yes |
| 0.001 | 0.125 | 1/8 | Yes |
| 0.101 | 0.625 | 5/8 | Yes |
| 0.111 | 0.875 | 7/8 | Yes |
| 0.0001 | 0.0625 | 1/16 | Yes |
| 0.1111 | 0.9375 | 15/16 | Yes |
| 101.101 | 5.625 | 5 5/8 | Yes |
| 0.0001100110011... | 0.1 | 1/10 | No — repeats forever |
| 0.010011001100... | 0.3 | 3/10 | No — repeats forever |
| 0.0101010101... | 1/3 | 1/3 | No — repeats forever |