Text to Binary: Differences, Edge Cases & Pitfalls

Convert text to 8-bit binary groups under UTF-8 or ASCII, with byte counts shown so size estimates stop being guesses.

Text to binary is just taking bytes per character under a chosen encoding: one byte per ASCII character, three bytes per CJK character in UTF-8, four per emoji. Length has nothing to do with how many glyphs you see, so size estimates must count bytes.

Format Differences

AspectText (characters)Binary (bytes)
UnitCharacters (code points)Bytes (groups of 8 bits)
Latin characters1 character1 byte (ASCII compatible)
CJK characters1 character3 bytes (UTF-8 variable length)
EmojiOne perceived "character" (multi-code-point)4 bytes; length counting is error-prone
Spaces and newlinesVisible whitespace0x20 and 0x0A, part of the encoding
ReadabilityHuman readableNot readable (all bits or hex)
SizeSmall by character countSame for ASCII, 2–4x larger for non-ASCII
ReversibilityThe originalFully reversible under the same convention

Edge Cases

  • Newlines differ per platform (LF vs CRLF), so normalise them before comparing binary strings across systems.
  • Invisible characters (zero-width space U+200B, BOM U+FEFF) get encoded but render as nothing; check them when lengths disagree.
  • Emoji are surrogate pairs in UTF-16, so grouping by "character" splits boundaries — work in code points or bytes.
  • Mixing UTF-8 and UTF-16 conventions yields completely different bit strings for the same text; decode with the same one.

Common Pitfalls

  • Treating the bit string as a number eats leading zeros and shifts every 8-bit group.
  • Trimming trailing spaces or newlines on export makes the decoded text differ from the original.
  • Estimating size by character count for CJK text understates it by three times.
  • Decoding GBK-encoded Chinese as UTF-8 produces mojibake that nothing flags automatically.

Related Tools