How binary becomes text
Computers store text as numbers. Each character is assigned a number by a character set, the number is stored in one or more bytes, and a byte is eight binary digits. Converting binary to text is that process run backwards: cut the digits into groups of eight, read each group as a number from 0 to 255, and look up the character.
01001000 01101001 72 105 ← each byte as a decimal number 48 69 ← the same bytes in hexadecimal H i ← the characters those numbers stand for
Binary, hexadecimal and decimal are three ways of writing the same byte. Binary is what the machine holds. Hexadecimal is what people use to read it, because one hex digit is exactly four bits, so every byte is exactly two digits. Decimal is what you get when a program prints a byte array.
| Character | Binary | Hex | Decimal |
|---|---|---|---|
A | 01000001 | 41 | 65 |
a | 01100001 | 61 | 97 |
0 | 00110000 | 30 | 48 |
| space | 00100000 | 20 | 32 |
| line feed | 00001010 | 0a | 10 |
{ | 01111011 | 7b | 123 |
é | 11000011 10101001 | c3 a9 | 195 169 |
€ | 11100010 10000010 10101100 | e2 82 ac | 226 130 172 |
Two patterns in that table are worth remembering. Upper- and lower-case letters differ by a single bit,
which is why A is 41 and a is 61. And the digit characters are not their own
values: the character 0 is byte 48, not byte 0.
ASCII, UTF-8 and why one character can be several bytes
The first 128 numbers, 0 to 127, are ASCII: the English alphabet, digits, punctuation
and control codes. Each fits in a single byte whose first bit is 0. Everything else — accented letters,
other scripts, symbols, emoji — needs more room, and UTF-8 provides it by using two,
three or four bytes for one character. The first byte's leading bits say how many bytes follow, and
every following byte begins with 10.
UTF-8 is the encoding of the web and of nearly every API, and plain ASCII text is already valid UTF-8,
so this converter always uses it. A tool that reads each byte as a separate character turns
é into é. That two-character garble has a name, mojibake, and it means
UTF-8 bytes were decoded as a single-byte encoding somewhere along the way.
If the bytes you paste are not valid UTF-8 — a lone continuation byte, a sequence cut short — the converter says so and shows each byte as its Latin-1 character instead, so you can still see what is there. That usually means the data is not text at all, or was written in an older encoding such as Windows-1252.
Input the converter accepts
| Form | Example |
|---|---|
| Bytes separated by spaces, commas or line breaks | 01001000 01101001, 48, 69 |
| An unbroken run | 0100100001101001, 4869 |
| Hex with prefixes | 0x48 0x69, \x48\x69 |
| Binary with prefixes | 0b01001000 0b01101001 |
| Decimal byte values | 72 105 |
An unbroken run must divide evenly into bytes: a multiple of eight binary digits, or an even number of
hex digits. If it does not, a digit has been lost or added, and the converter stops instead of guessing
where. Decimal always needs separators, because 7210 could be 72 and 10 or 7 and 210.
How auto-detect decides
Input containing only 0 and 1 is read as binary. Input containing any of the letters a to f is read as
hex. Digits alone are ambiguous — 48 69 is “Hi” in hex and “0E” in decimal — so the rule is:
if any value has three digits it is decimal, otherwise hex. When that guess is wrong for your data, set
the format yourself. The bar above the result always shows which format was used.
Where this turns up in API work
- Reading a hex dump. Packet captures,
xxdoutput and databaseBYTEAcolumns show bytes in hex. Paste the hex column to read the text. - Finding an invisible character. Convert a suspicious string to hex and a
non-breaking space shows up as
c2 a0where an ordinary space would be20; a byte-order mark isef bb bfat the very start. Both break JSON parsers, as the JSON validator explains. - Checking a signature or hash input. HMAC signatures on
webhooks are computed over exact bytes. Seeing the bytes
shows whether a line ending is
0aor0d 0a. - Byte arrays in logs. A language that prints
[72, 101, 108, 108, 111]is showing decimal bytes; paste the numbers to read them.
Hex output from a hash function is a different matter: a SHA-256 digest is 32 arbitrary bytes, not encoded text, and decoding it produces noise. The same goes for encrypted or compressed data. When binary data needs to travel inside JSON or a header, it is usually written as Base64, which packs three bytes into four characters instead of hex's two characters per byte. Bytes inside a URL are written as percent-encoded hex, which the URL decoder handles.
Frequently asked questions
How do I convert binary to text?
Split the binary digits into groups of eight, convert each group to a number, and look up the character for that number. This tool does all three steps: paste the binary and press Convert to text.
What is 01001000 01101001 in text?
It is “Hi”. 01001000 is 72, the code for a capital H, and 01101001 is 105, the code for a lower-case i.
How do I convert hex to text?
Read the hex two digits at a time; each pair is one byte, and each byte, or group of bytes in UTF-8, is a character. Paste the hex above, with or without spaces or 0x prefixes, and press Convert to text.
Why does my binary decode to strange symbols?
Usually because the data is not text. Hashes, encrypted data, images and compressed files are arbitrary bytes that do not spell anything. It also happens when digits are missing, so the groups of eight are misaligned, or when the text was written in an encoding other than UTF-8.
How many bits are in one character?
Eight bits, one byte, for the 128 ASCII characters. In UTF-8 other characters take two, three or four bytes: é is two bytes, the euro sign is three, and most emoji are four.
What is the difference between ASCII and UTF-8?
ASCII defines 128 characters, each stored in one byte. UTF-8 encodes every Unicode character in one to four bytes and is identical to ASCII for those first 128, so any ASCII text is also valid UTF-8.
Is my input sent to a server?
No. The conversion runs in JavaScript on this page and no network request is made with your data.
Related tools and reference
Base64 Decode and Encode
The usual way to carry binary data inside JSON or a header.
URL Decoder
Decode percent-encoded bytes such as %C3%A9.
Hash Generator
MD5 and SHA digests, written as hex.
HTML Encoder
Numeric character references such as é and €.
JSON Validator
Catches the invisible characters a hex view reveals.
Content-Type Header
How a response declares its character encoding.