Converters
Text to Binary: How Characters Become Bits (and Back Again)
See exactly how text turns into binary, hex, octal and decimal through character encoding, with runnable examples and Unicode gotchas explained.
Try the toolText to Binary →What does "text to binary" actually mean?
Computers store no letters — only numbers, and ultimately only bits. When you type A, the machine records the number 65, and stores that as the byte 01000001. "Converting text to binary" is really the act of looking up each character's numeric code and writing it out in base 2. It is a great way to demystify encoding, debug data at the byte level, or build a little puzzle or lesson.
The same idea extends to other bases: hexadecimal, octal and decimal are just different notations for the same underlying code points.
Character encoding in one minute
The mapping from characters to numbers is defined by a character encoding. For the basic English letters, digits and punctuation, ASCII assigns each a value from 0 to 127, which fits in a single 7- or 8-bit byte. Modern text uses UTF-8, a superset of ASCII that encodes the full Unicode range. Crucially, UTF-8 is variable-width: characters outside ASCII use two, three or four bytes.
A→ code point 65 → one byte:01000001i→ code point 105 → one byte:01101001é→ code point 233 → two UTF-8 bytes:11000011 10101001
This is why an emoji or accented letter produces more bits than a plain ASCII character — it simply takes more bytes to represent.
A practical walkthrough
To convert reliably across the whole Unicode range, encode the string to UTF-8 bytes first, then format each byte in the base you want. Here it is in JavaScript:
function textToBinary(str) {
const bytes = new TextEncoder().encode(str); // UTF-8 bytes
return Array.from(bytes)
.map(b => b.toString(2).padStart(8, "0"))
.join(" ");
}
textToBinary("Hi"); // "01001000 01101001"
textToBinary("H"); // "01001000"
// Same bytes in other bases:
Array.from(new TextEncoder().encode("Hi"))
.map(b => b.toString(16).padStart(2, "0")).join(" "); // "48 69" (hex)Decoding is the mirror image: parse each group back to a number, put the bytes in a Uint8Array, and run new TextDecoder().decode(...). Rather than wiring this up by hand, paste your string into the Text to Binary tool, pick binary, hex, octal or decimal, and copy the result — or paste code the other way to decode it. Everything runs locally in your browser.
Common pitfalls and tips
- Padding matters: Bytes are conventionally shown as 8 bits with leading zeros. Dropping them (
1000001instead of01000001) makes the stream ambiguous when you try to decode it. - Delimiters: Separate each byte with a space so a decoder knows where one character ends. Continuous streams like
0100100001101001require you to know the width in advance. - Unicode is multi-byte: A single visible character can be several bytes. Do not assume one character equals one byte — that only holds for ASCII.
- Byte code vs. code point: For non-ASCII text, the UTF-8 bytes differ from the raw Unicode code-point number. Decide which representation you actually want.
Once your data is in bytes, you might also reach for Base64 Encode / Decode to make it transport-safe, or the Number Base Converter to move a single value between bases.
Conclusion
Text-to-binary conversion is nothing more than character encoding made visible: each character has a numeric code, and binary, hex, octal and decimal are alternate spellings of that code. Keep the bytes padded and delimited, remember that Unicode characters can span several bytes, and you will be able to read, write and debug encoded text with confidence.