Fixed-width integers
Two's complement · accepts decimal, 0x…, 0b…, 0o…
Floating point
IEEE 754 · hover a field to isolate its bits above
Fixed point
An integer with an implied binary point: value = raw ÷ 2fraction bits · evenly spaced values, unlike floats
Text
Bytes in memory order · type text or escapes like \x00 \n \t \\ · unused trailing bytes are zero
UTF-8
1–4 bytes per code pointUTF-16
4 code units · little-endian, as Windows, Java and JavaScript store strings
Surrogates
As UTF-16BE
UTF-16 stores most characters in one 16-bit code unit. Characters beyond U+FFFF — most emoji — need two: a surrogate pair, a high surrogate (110110…) followed by a low surrogate (110111…) that together carry 20 bits. JavaScript strings are UTF-16, which is why "😀".length === 2. A surrogate without its partner is invalid.
Base64
3 bytes → 4 characters of 6 bits each| Bytes | Bits, regrouped into 6s | Characters |
|---|
Size
Base64 turns any bytes into plain text using 64 safe characters (A–Z, a–z, 0–9, + and /), so binary data can travel through email, JSON, data: URLs and JWTs. Every 3 bytes (24 bits) become 4 characters of 6 bits, making the text a third larger; a short final group is filled out with zero bits and “=” padding. The URL-safe variant swaps + and / for - and _.
Protobuf varint
Little-endian groups of 7 bits, read from B0 until a byte's MSB is 0
Stream
| Byte | Hex | MSB · payload | Shift | Contribution |
|---|
Values
uint64 · sint64 (ZigZag)Encoding writes only the varint bytes; bytes after the stream are left alone. This buffer holds 8 bytes, so at most 56 payload bits fit (max 256 − 1). Real protobuf allows 10 bytes — and a negative int64 always takes all 10, which is why sint64 uses ZigZag to keep small negatives short.
Time
Unix timestamps — counted from the epoch, 1970-01-01 00:00:00 UTC
Unix seconds · i32
bytes B0–B3 · classic 32-bittime_t
As u32
The Year 2038 problem: a signed 32-bit count of seconds runs out at 2038-01-19 03:14:07 UTC (). One second later it wraps to INT32_MIN — 1901-12-13 20:45:52 UTC. Try the Y2038 preset, then press +1. Read as unsigned it would last until 2106; modern systems use 64 bits.
Unix milliseconds · i64
bytes B0–B7 · JavaScriptDate, Java
As seconds
As µs
As ns
The same i64 means a very different date depending on the unit: seconds (C, Unix, most databases), milliseconds (JavaScript, Java), microseconds (Python, Postgres) or nanoseconds (Go, Linux kernel). JavaScript Date only allows ±8.64 × 1015 ms — about 271,821 BC to AD 275,760.
Network
Addresses are stored in network byte order — most significant byte first, at the lowest address
IPv4 address
bytes B0–B3
As a number
Native u32
A struct in_addr holds the four octets in network order: B0 is the first number. Read those bytes as a native u32 on a little-endian machine and the octets come out reversed — which is why C code calls htonl() / ntohl(). Try the “forgot htonl” preset.
MAC address
bytes B0–B5 · 48 bits
Device part
I/G bit
U/L bit
The first three bytes are the OUI, a prefix the IEEE assigns to each hardware vendor; the last three are chosen by the vendor. Two bits of the first byte are flags: bit 0 marks multicast, bit 1 marks a locally administered address (virtual machines, Docker, randomized Wi-Fi MACs). B6–B7 are unused.
Bit fields
One number carved into named groups of bits
Unix file mode
16-bitst_mode · bytes B0–B1
Full st_mode
Each octal digit is exactly three bits — r = 4, w = 2, x = 1 — which is why permissions are written in octal: 7 = rwx, 5 = r-x, 4 = r--. The leading digit holds the special bits: setuid (4, run as the file’s owner, e.g. passwd), setgid (2) and sticky (1, on /tmp: only a file’s owner may delete it).
FAT / ZIP timestamp
32-bit DOS date + time · bytes B0–B3MS-DOS packed a whole date and time into 32 bits by giving each part just enough bits: 7 for the year (counted from 1980), 4 for the month, 5 for the day and hour, 6 for the minute — and only 5 for the seconds, so it stores seconds ÷ 2. FAT file systems and every ZIP file still use it. There is no time zone, timestamps have 2-second resolution, and the year field runs out after 2107.
RISC-V instruction
RV32IM · 32 bits · bytes B0–B3, little-endian
In memory
The opcode in the low 7 bits picks the format (R, I, S, B, U or J), and the format decides where every other field sits. Register fields stay in the same place in every format and the immediate’s sign is always bit 31, so hardware can start reading registers before it knows the instruction — that is why the S, B and J immediates look scrambled.
Snowflake ID
64-bit · bytes B0–B7 · Twitter / X, Discord
Discord
Snowflake IDs let many servers create unique IDs without talking to each other: the time comes first so IDs sort by creation time, the machine field keeps servers apart, and the sequence counts IDs made in the same millisecond (up to 4,096). Twitter counts from 2010-11-04, Discord from 2015-01-01. 41 bits of milliseconds last about 69.7 years — Twitter’s IDs run out in 2080.
Color
Packed pixel formats · swatches follow the byte order of the grid above
2 × 32-bit
8 bits per channel1 × 64-bit
16 bits per channel4 × 16-bit RGB565
5 red · 6 green · 5 blue — green gets the extra bit because eyes are most sensitive to itBit stats & tricks
Counting and manipulating bits — the operations behind hash tables, allocators and chess engines