ASCII to binary: the idea
ASCII assigns a number from 0 to 127 to each letter, digit, symbol and control code, which makes 7 bits enough to write any of them. Converting ASCII to binary means looking up each character's number and writing it in base 2. Computers keep the characters in 8-bit bytes, so the 7-bit pattern is usually written with a leading 0. This page opens the converter on 7 bits so you can see the original code; switch to 8 bits for the byte form.
Worked example: ASCII
| Width | Result |
|---|---|
| 7 bits | 1000001 1010011 1000011 1001001 1001001 |
| 8 bits | 01000001 01010011 01000011 01001001 01001001 |
The two differ only by the leading 0 of each group. Characters above 127 do not fit in 7 bits: the converter then uses their UTF-8 bytes in groups of 8.
Digits 0 to 9
The digits start at code 48, so the character "0" is not the number 0:
| Character | Code | 7-bit binary |
|---|---|---|
| 0 | 48 | 0110000 |
| 1 | 49 | 0110001 |
| 2 | 50 | 0110010 |
| 3 | 51 | 0110011 |
| 4 | 52 | 0110100 |
| 5 | 53 | 0110101 |
| 6 | 54 | 0110110 |
| 7 | 55 | 0110111 |
| 8 | 56 | 0111000 |
| 9 | 57 | 0111001 |
Upper and lower case differ by one bit
| Upper | Binary | Lower | Binary | Difference |
|---|---|---|---|---|
| A | 1000001 | a | 1100001 | 32 |
| M | 1001101 | m | 1101101 | 32 |
| Z | 1011010 | z | 1111010 | 32 |
Every pair is 32 apart, which is the bit 0100000: flipping the third bit from the left switches the case. That is why old programs could change case with a single bitwise operation.
Spaces and special characters
| Character | Code | 7-bit binary | What it is |
|---|---|---|---|
| LF | 10 | 0001010 | line feed: the line break of Linux and macOS |
| TAB | 9 | 0001001 | horizontal tab |
| SP | 32 | 0100000 | the space, the first printable character |
| ~ | 126 | 1111110 | the last printable character before DEL (127) |
Common mistakes
- Calling any 8-bit table "ASCII": the real standard stops at 127. Codes 128 to 255 depend on the code page (ISO 8859-1, Windows-1252) and are not ASCII.
- Forgetting the space: it is a character with code 32 (0100000), and leaving it out glues the words together.
- Mixing the digit with its value: "5" is code 53 (0110101), not 101.
How to use the converter
- Type or paste the text in the first card; the 7-bit option is already selected.
- Choose the separator: a space, nothing or a line break between the groups.
- Copy the binary with the button.
Frequently asked questions
How many bits is ASCII?
7 bits, 128 codes from 0 to 127. It is stored in a byte of 8 bits with the top bit at 0, which is why ASCII text is also valid UTF-8.
What is the binary of the letter A?
A is code 65: 1000001 in 7 bits and 01000001 as a byte; a lower-case a is 97, 1100001.
What about accents and emoji?
They are not ASCII. The converter writes their UTF-8 bytes (two to four groups of 8 bits) and says so in a note under the box.