bfloat16 Inspector

Inspect Google Brain's 16-bit bfloat16 floating-point format

Ad placeholder (leaderboard)

bfloat16 (brain floating point) is a 16-bit format that keeps the full exponent range of a 32-bit float while throwing away most of its precision. This inspector lets you encode a decimal number into its nearest bfloat16 and decode any 16-bit pattern back into the real number it represents, showing every field.

How it works

A bfloat16 packs three fields into 16 bits:

[ sign : 1 ][ exponent : 8 ][ mantissa : 7 ]

The exponent uses a bias of 127. For a normal value the decoded number is:

value = (-1)^sign × (1 + mantissa/128) × 2^(exponent − 127)

When the stored exponent is 0 the value is subnormal (no implicit leading 1) or zero; when it is 255 the value is infinity (mantissa 0) or NaN. Because bfloat16 is exactly the high 16 bits of an IEEE-754 single, encoding a number just truncates the low mantissa bits — this tool applies round-to-nearest-even so the result matches real hardware.

Example and notes

The hex value 0x3F80 decodes to exactly 1.0: sign 0, exponent 127, mantissa 0. Entering 0.15625 encodes to 0x3E20 and decodes back to exactly 0.15625 because that value is representable. Try a value like 0.1 to see rounding error appear between what you typed and what bfloat16 can store. Remember that bfloat16 trades precision for range — it is designed for neural-network weights and activations, not financial arithmetic.

Ad placeholder (rectangle)