BITCOIN MAINNETLive explorer status
THE MATHS, GENTLY

Hexadecimal

Hex writes each byte as two characters from 0-9 and a-f. Learn to read hashes, keys and raw transactions, and convert numbers with our tool.

Counting in sixteens

Normal numbers use 10 digits. Hexadecimal (base 16) uses 16: 0–9 then a–f for 10 to 15.

DecimalHexBinary
000000
991001
10a1010
15f1111
255ff1111 1111

One byte = two hex characters

A byte holds values from 0 to 255, which is exactly 00 to ff. That's why:

  • a 32-byte hash is 64 hex characters,
  • a 20-byte public key hash is 40,
  • a 33-byte public key is 66.

Try it

TRY IT · DECIMAL, HEX AND BYTE ORDER
Hexadecimal0x7a120
4 bytes, big-endian (how people write numbers)00 07 a1 20
4 bytes, little-endian (how Bitcoin stores most numbers)20 a1 07 00

Bitcoin stores many numbers in reverse byte order; the converter above shows both. See Bytes and endianness.

Converting by hand

To turn hex 1f into decimal: 1 × 16 + f (15) = 31. For longer numbers, each position is worth 16 times the one to its right, just as each decimal place is worth 10 times.

Common Bitcoin values in hex

ValueHexWhere
1 BTC in sats05f5e100Output amounts
Block 840,0000cd140Coinbase height
OP_RETURN6aData outputs
OP_CHECKSIGacEnd of most scripts
Share this guide
Share on X ↗

Key takeaways

  • Hex is base 16, using 0–9 and a–f.
  • Every byte is exactly two hex characters.
  • Hashes, keys and raw transactions are usually shown in hex.

Common questions

Is 0x part of the number?

No. 0x is a prefix that says 'this is hex'.

Are uppercase and lowercase hex the same?

Yes. A and a both mean 10.

Why does Bitcoin use hex instead of normal numbers?

Hex maps cleanly to bytes, so binary data like hashes and scripts stays readable and exact.

Is 0x part of the hex number?

No, it's just a prefix that marks the number as hexadecimal.