StringMash.com

Text and ASCII to binary

Every character as the bits a computer actually stores, eight digits at a time.

Conversion
7 characters
Updates as you type
8 digits per byte

Show the steps
  1. Each character has a number. UTF-8 stores it as one or more bytes, and each byte is written as 8 binary digits.
  2. H is 72, which is 01001000
  3. i is 105, which is 01101001
  4. space is 32, which is 00100000
  5. c is 99, which is 01100011
  6. a is 97, which is 01100001
  7. f is 102, which is 01100110
  8. é is U+00E9, too big for one byte, so UTF-8 uses 2: 11000011 10101001
Printable chart

Using the converter

Type on the left. Eight digits appear on the right for every byte, and Separator decides whether the bytes are spaced apart or run together as one string.

Paste binary in and swap the boxes to read it back as text. The binary translator does the same job with a shorter sample.

One character is not one byte

The sample above is deliberate. Hi is two characters and two bytes, so it costs 16 digits. The é in café is one character and two bytes, so it costs 16 on its own.

That's UTF-8. A character below 128 is stored as a single byte with a leading 0, exactly as ASCII always did. Anything above that is stored as two, three or four bytes, and the leading bits of the first byte announce how many follow. An emoji usually takes four bytes, so 32 binary digits.

Converters that assume one byte per character break here. They either mangle the accent or silently drop it. This one encodes every character, emoji included. Going back, binary that isn't valid UTF-8 gets an error rather than a garbled guess.

A-Z AND 0-9

Every letter in eight digits

A01000001
B01000010
C01000011
D01000100
E01000101
F01000110
G01000111
H01001000
I01001001
J01001010
K01001011
L01001100
M01001101
N01001110
O01001111
P01010000
Q01010001
R01010010
S01010011
T01010100
U01010101
V01010110
W01010111
X01011000
Y01011001
Z01011010
000110000
100110001
200110010
300110011
400110100
500110101
600110110
700110111
800111000
900111001

Designed on a placemat in New Jersey

UTF-8 was sketched in September 1992 by Ken Thompson and Rob Pike, in a diner in New Jersey, on a placemat. Thompson wrote the encoder and decoder that evening and the pair had Plan 9 converted within days.

The existing proposal, UTF-1, would have broken Unix, because it reused printable ASCII bytes inside a multi-byte character, so a slash could turn up in the middle of one and split a file path. Thompson's design keeps ASCII bytes exactly as they were and guarantees no byte of a multi-byte sequence can be mistaken for an ASCII one. Old software carried on working untouched.

That property is why UTF-8 won. By 2008 it had passed every other encoding on the web, and it now accounts for over 98% of pages.

Related conversions

Text to hex shows the same bytes in a quarter of the space, because one hex digit stands for four binary ones. ASCII gives you the decimal code point rather than the stored bytes, and the two differ as soon as a character leaves ASCII, like the é in café.

To see the code point behind a character rather than its bytes, use the Unicode converter.

Questions

How do I convert text to binary?

Type it above and read the result. Each byte becomes eight binary digits, and characters outside ASCII take more than one byte.

Why is my emoji so long in binary?

Most emoji are four bytes in UTF-8, so they take 32 binary digits. Some are several code points joined together and take much more.

Is binary the same as ASCII?

No. ASCII is a table assigning numbers to characters. Binary is a way of writing those numbers. A page can be ASCII and be shown in decimal, hex or binary.

What does 01001000 mean?

It's 72 in decimal, which is a capital H. Eight digits is one byte, and for characters in the ASCII range one byte is one character.

Sources

Added . Last updated and reviewed . What's new