TECHNICAL_DOC // GENERAL / HEXADECIMAL
HEXA-
DECIMAL
DECIMAL
Hexadecimal (base-16) is the universal notation for Bitcoin's raw data.
Each hex digit represents exactly 4 bits (a nibble), so a single byte is always two hex
characters. Hashes, private keys, raw transactions, block headers, and scripts are all
represented and exchanged as hex strings — making hex literacy essential for anyone
working with Bitcoin at the protocol level.
HEX_FUNDAMENTALS
BASE-16 DIGIT MAPPING
Decimal: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Hex: 0 1 2 3 4 5 6 7 8 9 A B C D E F
Binary: 0000 ... 1001 1010 1011 1100 1101 1110 1111
1 hex digit = 4 bits = 1 nibble
2 hex digits = 8 bits = 1 byte (00 to FF)
64 hex chars = 32 bytes = 256 bits (SHA256 hash)
Prefix 0x indicates hex notation:
0xFF = 255 decimal
0x01 = 1 decimal
0x1A = 26 decimal
Bitcoin Data in Hex
EXAMPLES
Every piece of Bitcoin data you encounter in practice is expressed as hex — from addresses' underlying bytes to transaction/">raw transaction blobs.
SHA256d block hash (32 bytes = 64 hex chars):
000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
Private key (32 bytes = 64 hex chars):
0c28fca386c7a227600b2fe50b7cae11ec86d3bf1fbe471be89827e19d72aa1d
OP_RETURN script (example):
6a 14 ... (6a = OP_RETURN opcode, 14 = push 20 bytes)
Version field in raw tx (4 bytes LE = 8 hex chars):
01000000 ← version 1
02000000 ← version 2
Magic bytes for Bitcoin P2P:
f9beb4d9 ← mainnet message start
TERMINOLOGY_INDEX
Hexadecimal
Base-16 numeral system using digits 0–9 and A–F. Each digit represents 4 bits.
Nibble
4 bits. One hex digit. Two nibbles form one byte.
0x prefix
Notation convention indicating a number is hexadecimal. E.g. 0xFF = 255 decimal.
Hex string
A text representation of binary data as hexadecimal digits. Length is always 2× the byte count.
INTERACTIVE — TRY IT YOURSELF
INTERACTIVE_DOC // GENERAL / HEXADECIMAL
HEXADECIMAL
INTERACTIVE
INTERACTIVE
Every byte you'll ever see in Bitcoin is shown in hex. To read raw transactions, decode
hashes, or debug a script, you need fluent hex literacy — the ability
to look at
0xF9BEB4D9 and see 4 bytes, 32 bits, 8 nibbles, all at
once. This page replaces explanation with manipulation: click bits, watch every
representation update, then witness the avalanche effect that makes hex-level
debugging actually useful.
§ 1 — THE BIT/NIBBLE/BYTE EQUIVALENCE
One hex digit encodes exactly 4 bits — a "nibble". Two hex digits make
1 byte, with values
0x00 through 0xFF
(0–255 decimal). The mapping from hex digit to nibble is fixed: 0=0000,
F=1111. Click bits below to feel the relationship.
INTERACTIVE — 32-BIT REGISTERclick any bit to flip
HEX
0x12345678
DECIMAL
305419896
BINARY
0001 0010 0011 0100 0101 0110 0111 1000
Notice: flipping the rightmost bit changes the hex by
±1.
Flipping the bit at the 8-position changes hex by ±8. Flipping the
leftmost bit of a byte changes that byte by ±128. Each bit's positional value is
2ⁿ within its nibble — the same "place value" rule from grade school,
just base 2 instead of base 10.
§ 2 — BIDIRECTIONAL CONVERSION
Type into any of the three fields below — the others convert live. Try
FF → 255 → 11111111, then 100 →
0x64 → 01100100. Internalize that hex is not "weird programmer
notation" — it's just decimal's base-16 cousin where one symbol = one nibble.
INTERACTIVE — HEX ⇄ DECIMAL ⇄ BINARYtype in any field
§ 3 — THE AVALANCHE EFFECT (WHY HEX MATTERS)
A cryptographic hash function turns any input into a fixed-size hex output
where flipping a single input bit flips, on average, half the output bits.
This is the avalanche property — it's why two near-identical inputs
produce wildly different hex digests, and why hex-level inspection is a debugging
superpower: any mistake in your hashing pipeline is visible at first glance.
INTERACTIVE — SHA-256 AVALANCHEedit one character
SHA-256 OF YOUR INPUT
—
SHA-256 OF "bitcoin" (1-CHAR DIFF)
—
— differing bits: …
§ 4 — REAL BITCOIN DATA INSPECTOR
Hover over any byte below to see its decimal value and position. Click the tabs to
load real Bitcoin data — every one of these is a hex string you'll meet in the wild.
Note how the byte-count and structure varies by data type.
INTERACTIVE — HEX BYTE INSPECTORhover bytes
—
TERMINOLOGY_INDEX
Hexadecimal
Base-16 numeral system using digits 0–9 and A–F. Each digit represents 4 bits.
Nibble
4 bits = 1 hex digit. Two nibbles form one byte (8 bits).
Byte
8 bits = 2 hex digits. Range 0x00–0xFF (0–255 decimal).
0x prefix
Notation indicating hexadecimal. 0xFF = 255. Inherited from C; standard across most languages.
Hex string
Text representation of binary data as hex digits. Length is always 2× the byte count.
Avalanche
Property of cryptographic hashes: 1 input-bit change flips ~50% of output bits. Makes hex-level diffs informative.
Endianness
Order in which bytes are stored. Bitcoin uses little-endian for integers — see the LE interactive page for detail.