Glossary | Bits


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


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 preceeding 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: May 13 2017
  • May 13 2017: Ajax Tooltips - wrap <span data-tip="txid"> around anything and it will grab the description from the yaml:tip in a glossary page
  • Feb 24 2017: CSS - glossary pages now use .center instead of .title for images inside figures
  • Jan 20 2017: - updated diagram to something more exact
  • Jan 20 2017: - Rewrote, because target adjusts by itself, not from an internal difficulty value. Also added a handy svg diagram.
  • Jan 13 2017: tidied up glossary pages - css, formatting, restructuring
  • Jan 02 2017: Added target tooltip above blockhash on block.php and candidatblock.php when hovering over the Bits field in the block header.
  • Jan 01 2017: Moved /manual/guide/ and /manual/reference/ to /guide/ and /glossary/