Security FIELD NOTES · 3 MIN READ
Reading Data Through Its Bytes
UTF-8 bytes, the printable/control/high-byte split, and Shannon entropy — what a byte distribution table reveals about any string.
Hand someone a mysterious string and the first real question is not "what does it say?" but "what kind of thing is it?" Byte-level analysis answers that in seconds: how the data is built out of its 256 possible byte values, which classes of bytes it favours, and how unpredictable those bytes are. It is the data equivalent of checking a fabric's weave before deciding what the garment is.
From characters to bytes
Computers store bytes, not characters. Under UTF-8 — the encoding that carries the web — ASCII letters, digits and common punctuation are one byte each, while anything above the ASCII range takes over: "café" is 5 bytes because é costs two (0xC3 0xA9), and an emoji costs four. Counting characters tells you what a human reads; counting bytes tells you what the machine actually stores, sends and hashes. The full journey from characters to code points to encoded bytes is told in How Text Encoding Works; here we stay one level below it, where the bytes themselves become the data.
The three classes of bytes
The 256 byte values sort into three revealing classes. Printable ASCII (0x20–0x7E) is the visible keyboard range — letters, digits, punctuation. Control bytes (0x00–0x1F plus 0x7F) are invisible machinery: tab, newline, NUL. High bytes (0x80–0xFF) are where UTF-8 puts its multi-byte sequences and where binary formats put everything else. The proportions are a fingerprint: plain English is almost entirely printable with a few control bytes for line breaks; accented text shows a modest high-byte share; binary files, images and cryptographic output scatter across all three. A blob that is 100% printable is almost certainly an encoding — Base64, hex — rather than raw binary.
Shannon entropy in one formula
Entropy quantifies unpredictability. For a byte distribution, H = −Σ p·log₂(p), where p is each byte's share of the total, measured in bits per byte. The value ranges from 0 — every byte identical, zero surprise — to a maximum of 8, when all 256 values appear equally often and each new byte is maximally surprising. A small worked example: the string "aaab" has p(a) = 0.75 and p(b) = 0.25, so H = −(0.75·log₂0.75 + 0.25·log₂0.25) ≈ 0.81 bits/byte. Weight the two symbols equally and H reaches 1; spread uniformly across the 95 printable characters and H = log₂95 ≈ 6.57. The formula is the same one that underlies hash functions, where avalanche behaviour pushes digests toward uniformity.
What entropy says about your data
Real data occupies recognizable entropy bands. English text lands around 4 to 5 bits per byte; structured formats like JSON or CSV score similarly because syntax repeats. Compressed and encrypted data, and cryptographic keys, hashes and tokens, cluster near 8 — engineered to be indistinguishable from noise. That band structure makes entropy a fast first responder: a "random-looking" string measuring well under 8 bits/byte is probably an encoding, not ciphertext (Base64, with its 64-symbol alphabet, tops out near 6 by construction); a string measuring 8.00 is not human-generated text. Entropy never proves anything — it ranks hypotheses and tells you which tool to reach for next.
Try it yourself
Paste "aaab" into the Byte Frequency Analyzer and confirm 4 bytes, entropy 0.8113, with the byte 0x61 ("a") holding 75%. Paste "café" to see 5 bytes with two high bytes. Then compare regimes: an English paragraph, a Base64 string, and a hash such as the output of the Hash Generator — the climb from ~4.5 toward 8 bits/byte is the lesson. For letter-level rather than byte-level patterns, the Letter Frequency Counter shows the human-visible layer, and the Checksum Calculator pairs with byte analysis when verifying a file's integrity.