ASCII to Binary

Start from characters or from their ASCII codes, and get binary in 7-bit, 8-bit or with a parity bit. Anything that isn't real ASCII gets pointed out.

I have
Format
Between codes
Line breaks
Try

Each character and its bits

ASCIIDecimalHexBinary

How to convert ASCII to binary by hand

Every ASCII character has a number from 0 to 127. Find the number, then write it in base 2 using seven places. The capital R is 82. Go through the place values from 64 down and take away each one that fits. A value that fits gets a 1, and one that doesn't gets a 0.

Place valueLeft over beforeFits?Bit
6482Yes, leaves 181
3218No0
1618Yes, leaves 21
82No0
42No0
22Yes, leaves 01
10No0

Read the last column from top to bottom: 1010010. Put a 0 in front and you have the 8-bit byte, 01010010. For a whole word, repeat this for each character and keep them in order.

If you don't know a character's number, look it up in the full ASCII table. For dividing by 2 instead of subtracting, see decimal to binary.

Write letters and digits without the table

For letters and digits you can skip the sums. Write a fixed opening, then add a short number you already know. These are 7-bit codes.

For aOpen withThen addExample
Capital letter10Position in the alphabet, 5 bitsE is 5th: 10 00101
Lowercase letter11Position in the alphabet, 5 bitse is 5th: 11 00101
Digit011The digit itself, 4 bits5: 011 0101

Try your own initial. M is the 13th letter, 13 in five bits is 01101, so capital M is 1001101.

The character "42" and the number 42

ASCII converts characters one at a time. Typed as ASCII, 42 is the character 4 followed by the character 2, so you get two codes: 00110100 00110010. As a single number, 42 is 101010.

The tabs above the converter handle a third case. If your 42 is already an ASCII code, from a table or a worksheet, choose "Decimal codes". Code 42 is the asterisk, so the answer is 00101010. For the plain number, use the decimal to binary converter.

What a parity bit does

ASCII needs seven bits, which leaves one spare in a byte. Some serial links and older equipment use it to catch transmission errors. With even parity, the extra bit is chosen so the byte has an even number of 1s. With odd parity, the total comes out odd.

Letter7-bit code1sEven parityOdd parity
A100000120100000111000001
C100001131100001101000011
E100010131100010101000101

If one bit flips on the way, the count no longer matches and the receiver knows the byte is bad. It can't tell which bit changed, and two flipped bits cancel out and go unnoticed.

This converter writes the parity bit on the left, as the highest bit of the byte. A serial port sends bits in its own order and adds parity in hardware, so a setting such as "7E1" doesn't need you to add it by hand.

The characters you can't see

Spaces, tabs and line breaks have codes too, so they show up in your binary. A space is 00100000 and a tab is 00001001.

A line break depends on where the file is going. Linux and macOS use one code, LF, 00001010. Windows text files and many internet protocols use two, CR then LF, 00001101 00001010. Use the "Line breaks" setting to match. If your answer is one byte per line short of someone else's, this is the first thing to check.

Punctuation and symbols in binary

These are the space and the 32 punctuation marks and symbols in ASCII, as 8-bit bytes.

SymbolCodeBinary
space3200100000
!3300100001
"3400100010
#3500100011
$3600100100
%3700100101
&3800100110
'3900100111
(4000101000
)4100101001
*4200101010
+4300101011
,4400101100
-4500101101
.4600101110
/4700101111
:5800111010
SymbolCodeBinary
;5900111011
<6000111100
=6100111101
>6200111110
?6300111111
@6401000000
[9101011011
\9201011100
]9301011101
^9401011110
_9501011111
`9601100000
{12301111011
|12401111100
}12501111101
~12601111110

Characters that look like ASCII but aren't

Word processors and phone keyboards often change what you type. A straight apostrophe turns curly, two hyphens become a long dash, or three dots shrink into a single character. They look harmless, but ASCII has no code for any of them.

The converter stops and names them instead of quietly writing different bytes. For quotes, dashes, the one-character ellipsis and non-breaking spaces, one button swaps in plain versions. Letters such as é or ñ have no automatic swap, because changing them could change a word or a name. To keep them as they are, use text to binary, which encodes them as UTF-8.

Check these before you hand in an answer

The wrong width

A worksheet that shows seven digits per character wants 7-bit. Most software expects eight. The only difference in plain ASCII is the leading 0.

Lost leading zeros

A space is 32, or 100000 in bare binary. As a 7-bit code it's 0100000. Pad every character to the full width, especially if you join them without spaces.

Capital and lowercase swapped

Q is 01010001 and q is 01110001. Your phone may capitalise the first letter without asking, so check how your text begins.

Parity you didn't want

With even or odd parity on, some bytes start with 1. A plain decoder reads those as values above 127. Choose 8-bit unless the task asks for parity.

Practice on paper

Write each one as 8-bit binary, then load it into the converter to compare. Count spaces and punctuation as characters.

Convert "Ok"

Convert "A+"

Convert "No. 7"

ASCII to binary FAQ

What is A in binary?

Capital A is ASCII code 65. It's 1000001 in 7 bits and 01000001 as a byte.

How is this different from text to binary?

This page sticks to the 128 ASCII characters and can start from their codes or add parity. Text to binary accepts any language and emoji by using UTF-8. For plain English text in 8 bits, both give the same bytes.

How many bits will my message need?

Count every character, including spaces and line breaks, then multiply by 7 or 8. With CR LF, each line break counts as two characters. The total appears under the converter.

Can I paste a list of codes?

Yes. Choose decimal or hex and separate the codes with spaces, commas or new lines. Hex codes can also be one unbroken run of pairs, such as 48656C6C6F.

How do I turn the binary back into characters?

Use binary to ASCII. It reads 7-bit and 8-bit codes. If you added parity, remove the first bit of each byte first.

Is my text sent anywhere?

No. The conversion runs in your browser, so what you type never reaches our server.