Encodings

Binary

Eight bits per byte spelled out in zeros and ones. Spaces between bytes by default
IDbinary01 / 20binary · 2 characters
Encoding / Binary

Binary

Every bit spelled out. Eight characters a byte.

Overhead
+700% on random bytes
Padding
none
Standard
Base2, most significant bit first
Family
1 in binary
family 1 / 20

Sample

Out
01101000 01100101 01101100 01101100 01101111 00100000 01110111 01101111 01110010 01101100 01100100 00100001
Back
"hello world!"

Options

separateboolean
default true
Put a space between bytes

Access

Importimport { binary } from "@agntn/encodings/binary"
CLIencodings encode binary 'hello world!'
Tryplayground with the sample above

The most honest encoding there is. Every bit, out loud, most significant first.

ts
encode("binary", "Hi");                       // "01001000 01101001"
encode("binary", "Hi", { separate: false });  // "0100100001101001"

Decoding skips whitespace, so both forms read back the same. A count that isn't a multiple of eight is an error, not a guess about where the missing bits went. Puzzles love this one. Ever counted zeros by hand at 2am? Don't.