Tool · number formats

Number format explorer

What does a value look like in FP16, BF16, FP8 and FP4, bit by bit, and what is lost?

How it counts
value = (−1)^sign × 2^(exponent − bias) × 1.mantissa
What does each format actually store?
FormatBits: sign · exponent · mantissaStored valueError
FP32
the classic float
001111011100110011001100110011010.1000000011.5e-6%
FP16
half precision
00101110011001100.09997558590.024%
BF16
FP32's range, less precision
00111101110011010.1000976560.098%
FP8 E4M3
8 bits, more precision
000111010.10156251.6%
FP8 E5M2
8 bits, more range
001011100.093756.3%
FP4 E2M1
4 bits, 15 values
00000lost
BF16, decoded: Sign 0 (positive). Exponent bits 01111011 = 123, minus the bias 127: -4. Mantissa 1.1001101 in binary = 1.6015625. Value = 1.6015625 × 2-4 = 0.100097656. Next number up: 0.100585938, a gap of 0.00048828125 (0.49% of the value).

Click a row to decode it. Rounding to the nearest value, ties to even, with subnormal numbers. FP32, FP16, BF16, and FP8 E5M2 overflow to infinity; FP8 E4M3 and FP4 E2M1 have no infinity and saturate to their largest value. Checked bit for bit against the ml_dtypes library. The Qwen3-8B weight is a real one (layer 10, stored in BF16, hence exact in BF16).