A Bitcoin header's 4-byte nBits field encodes the 256-bit target in a compact floating-point-like form: the top byte is an exponent in base 256 and the lower 23 bits are the mantissa, so the target equals mantissa times 256 to the power of (exponent minus 3).
Sources and checks
T1Bitcoin Core src/arith_uint256.h, SetCompact commentSource code, says this directly
The most significant 8 bits are the unsigned exponent of base 256.
Comment above arith_uint256::SetCompact, read 2026-11-20
T1Bitcoin Core src/arith_uint256.h, SetCompact commentSource code, says this directly
N = (-1^sign) * mantissa * 256^(exponent-3)
Comment above arith_uint256::SetCompact, read 2026-11-20
bitcoin/bitcoin at f498a5a671 contains this text in src/arith_uint256.h.
Run it yourself
git clone https://github.com/bitcoin/bitcoin && git -C bitcoin show f498a5a6718d9157b6afb85412c3462439117702:src/arith_uint256.h | grep -nF 'N = (-1^sign) * mantissa * 256^(exponent-3)'Checked at block 976,753, 20 Nov 2026, 16:42 UTC: quotes 2/2, code 1/1
History
Nothing is edited silently; every revision keeps what it replaced.
- 20 Nov 2026, 16:42 UTCblock 976,753
Published Revision 1, run 2026-11-20-seed-proof-of-work