• Hash256
  • Hash160
  • Reverse Bytes
  • Hexadecimal
  • Satoshis

Bits

The target in a compact format.

The bits field is a compact way of storing the target in the block header.

Example

Here’s what the target was when Block 406,800 was mined:

Target: 0x00000000000000000696f4000000000000000000000000000000000000000000

And this is the Bits field you’ll find in the block header for it:

Bits: 0x180696f4

Converting Bits

Bits is just a shorthand version of the Target.

It looks alien at first, but it’s basically split in to two parts:

  1. Exponent: This gives you the size of the target in bytes.
  2. Coefficient: This gives you the initial 3 bytes of the target.
I think of it as using the exponent to calculate how many zeros to write down, then I replace the first 3 bytes with the coefficient.

So if you want to find out what the Target was when a block was mined, the Bits field will help you work out the (slightly rounded up) value of it.

Bits -> Target

Remember that the exponent is a hexadecimal number, so 0x18 means that’s 24 bytes in decimal.

The coefficient part taken from the original target is always rounded up. Here’s the current target.

The full target is often shown as 32 bytes in length, which is where all those preceding zeros come in. But really all of the following are the same number:

Target: 0x00000000000000000696f4000000000000000000000000000000000000000000
Target: 0x0696f4000000000000000000000000000000000000000000
Target: 0x696f4000000000000000000000000000000000000000000

Why have “Bits”?

Question: Why ever would you convert the Target in to “Bits”? Why not just store the full Target in the block header?

Answer: Because the block header doesn’t need to store the absolute precision of the full Target, so the Bits format saves on space.

By Greg Walker,

Last Updated: 04 Feb 2021
  • 04 Feb 2021: spelling fixes
  • 21 Jul 2020: renamed /guide/ to /technical/
Back to Top

Hey there, it's Greg.

I'll let you know about cool website updates, or if something seriously interesting happens in bitcoin.


Don't worry, it doesn't happen very often.