ASCII to binary

Convert ASCII text to binary in 7 or 8 bits, with a digit and letter table, the case-bit trick and a worked example.

loading ASCII to binary
About this tool

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

WidthResult
7 bits1000001 1010011 1000011 1001001 1001001
8 bits01000001 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:

CharacterCode7-bit binary
0480110000
1490110001
2500110010
3510110011
4520110100
5530110101
6540110110
7550110111
8560111000
9570111001

Upper and lower case differ by one bit

UpperBinaryLowerBinaryDifference
A1000001a110000132
M1001101m110110132
Z1011010z111101032

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

CharacterCode7-bit binaryWhat it is
LF100001010line feed: the line break of Linux and macOS
TAB90001001horizontal tab
SP320100000the space, the first printable character
~1261111110the 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

  1. Type or paste the text in the first card; the 7-bit option is already selected.
  2. Choose the separator: a space, nothing or a line break between the groups.
  3. 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.

Report a problem