Yoryantra
← Back to Tools

Binary Encoder Decoder

Treat binary as bytes first and text second. Encode Unicode text to UTF-8, decode only valid UTF-8 from complete 8-bit bytes, or inspect arbitrary binary without forcing it through a text decoder.

Decode/inspect accepts 8-bit groups separated by spaces, commas, semicolons or line breaks; 0b01000001 tokens; or one continuous bit string whose length is a multiple of eight.

Encoding, strict UTF-8 decoding and byte inspection run on the pasted data in your browser. No text or byte sequence is sent to a separate conversion API. Site-wide analytics or advertising scripts, if enabled, are separate from that local processing.

Binary Has No Character Encoding Until You Choose One

11110000 10011111 10011010 10000000 is four bytes. Under UTF-8 those bytes form 🚀. In a compressed file, encrypted payload or image, the same numbers would be interpreted by a completely different format.

That distinction is why Inspect bytes is separate from UTF-8 decoding: the byte values can be examined without first asserting that the stream is text.

Complete Bytes Can Still Be Invalid UTF-8

Eight bits always make a byte, but not every byte sequence makes a UTF-8 string. Bytes C0 and C1 cannot begin legal UTF-8 characters; F5–FF are also invalid as UTF-8 lead bytes; continuation bytes 80–BF need an appropriate preceding lead byte.

Decode mode uses TextDecoder("utf-8", { fatal: true }). Malformed input therefore produces an error instead of silently turning bad bytes into replacement characters and making the original data harder to diagnose.

UTF-8 Keeps ASCII at One Byte and Expands the Rest

A
U+0041 → 41 hex → 01000001
1 UTF-8 byte
U+20B9 → E2 82 B9
3 UTF-8 bytes
🚀
U+1F680 → F0 9F 9A 80
4 UTF-8 bytes

A “binary character” is therefore not a fixed eight-bit concept for Unicode text. UTF-8 encoding turns the string into bytes first; each resulting byte is then printed as eight binary digits.

Separated Bits Mean You Are Claiming Byte Boundaries

If you paste 01000001 01000010, the spaces say “these are two bytes.” A seven-bit or nine-bit token between separators is therefore rejected. With continuous input, the only requirement is that the total number of bits is divisible by eight.

That strictness catches a common copy/paste error where one missing bit shifts every byte that follows.

Lone UTF-16 Surrogates Need Attention Before Encoding

JavaScript strings use UTF-16 code units internally. Correct supplementary characters use a high/low surrogate pair, but broken programmatic strings can contain one half by itself. Browser TextEncoder converts lone surrogates to U+FFFD.

For diagnostics, that substitution is dangerous because it changes the data. An unpaired surrogate is reported at its UTF-16 code-unit position before UTF-8 encoding begins.

Same-Looking Text Can Produce Different Bytes

Unicode can represent some visible text in more than one canonically equivalent way. For example, é can be one code point (U+00E9) or e followed by COMBINING ACUTE ACCENT (U+0065 U+0301). Those strings can look the same while producing different UTF-8 byte sequences.

No normalization is applied before encoding, because silently changing code points would also change the bytes being inspected. When byte-for-byte equality matters for identifiers, signatures, hashes or security checks, decide on a normalization policy at the application boundary rather than assuming visual equality means binary equality.

Byte Patterns Worth Recognizing During Debugging

BytesCommon meaningWhy it matters
00NULInvisible; can terminate strings in C-style APIs.
0ALFUnix-style line feed.
0D 0ACRLFCommon network/Windows line ending.
EF BB BFUTF-8 BOMCan be harmless or surprise parsers expecting content at byte zero.

Do Not Use a Text Decoder for Files Just Because They Are Bytes

PNG, ZIP, gzip, encrypted ciphertext, hashes and most protocol frames are byte sequences but not UTF-8 strings. Forcing them through text decoding can fail—or worse, appear to work after replacement characters destroy the original values.

Use Inspect mode for byte-oriented investigation. Decode mode is intentionally reserved for the stronger claim: “these bytes should be valid UTF-8 text.”

WHATWG Encoding Standard

Defines the browser TextEncoder/TextDecoder APIs and the UTF-8 encoder/decoder behavior used by modern web applications.

RFC 3629 — UTF-8

Documents valid UTF-8 byte-sequence ranges, the preserved US-ASCII range, surrogate exclusion, BOM considerations and security issues around visually equivalent Unicode sequences.