FP16 and bfloat16 Converter

Convert a number to half precision (FP16) and bfloat16 side by side. See the bits, the stored value and the error of each, with FP32 for reference, or read a 16-bit pattern back.

Converter Number Systems Updated Oct 3, 2026
How to Use
  1. Choose number to bits, or bits to number to read a 16-bit pattern.
  2. Type a number such as 0.1, 3.14159 or 70000, or a hex pattern such as 0x3C00.
  3. For bits to number, say whether the pattern is FP16 or bfloat16.
  4. Compare the two formats in the readouts and the drawing: the same 16 bits split differently between range and precision.
  5. The table gives each format’s error and range, and the FP32 value for reference.
Input
a number16-bit hex
Presets
Same 16 bits, split two ways
FP16 hex
—
FP16 value
—
bfloat16 hex
—
bfloat16 value
—

Worked Example

0.1 in FP16. 0.1 = 1.6 × 2⁻⁴. The exponent field is −4 + 15 = 11 = 01011. The mantissa is 0.6 × 1024 = 614.4, rounded to 614 = 10 0110 0110. So FP16 0.1 is 0x2E66, which is exactly (1 + 614/1024) × 2⁻⁴ = 0.0999755859375, an error of −0.024%.

0.1 in bfloat16. The exponent field is −4 + 127 = 123 = 0111 1011, and only 7 mantissa bits: 0.6 × 128 = 76.8, rounded to 77. That is 0x3DCD = (1 + 77/128) × 2⁻⁴ = 0.10009765625, an error of +0.098%, four times worse than FP16, but bfloat16 can also hold 10³⁸.

The common mistake: assuming 16 bits is 16 bits. 70,000 fits easily in bfloat16 (as 70,144) but overflows FP16 to infinity, while 2,049 is exact in neither: FP16 rounds it to 2,048 and bfloat16 to 2,048 as well. Choose the format by the range and precision your data needs.

Show Work

Enter a number to see the step-by-step working.

Formulas

FP16
(−1)s × 1.f × 2e − 15
1 + 5 + 10 bits
bfloat16
(−1)s × 1.f × 2e − 127
1 + 8 + 7 bits
float32 → bf16
(x + 0x7FFF + ((x >> 16) & 1)) >> 16
round to nearest even
Epsilon
FP16 2−10 · bf16 2−7
Largest
FP16 65,504 · bf16 ≈ 3.39 × 1038

Two Ways to Spend 16 Bits

Half precision began in graphics: NVIDIA’s Cg language and Industrial Light & Magic’s OpenEXR image format used a 16-bit float in the early 2000s, and IEEE 754 adopted it as binary16 in 2008. bfloat16, the “brain floating point” format, came from Google Brain for training neural networks on TPUs, where keeping float32’s exponent made it a drop-in replacement.

The two formats show the basic trade-off of floating point: every bit moved from the mantissa to the exponent doubles the range in powers of two but halves the precision. Machine learning now goes further still, to 8-bit and even 4-bit floats; the minifloat converter covers those.

About This Calculator

This converter rounds a number to IEEE half precision (FP16) and to bfloat16 at the same time, showing both bit patterns, the values actually stored and their errors, with the float32 bits for comparison. It can also decode a 16-bit pattern in either format. Rounding is to nearest, ties to even, done exactly.

Everything runs in your browser; nothing is sent anywhere. For 32- and 64-bit floats use the IEEE 754 converter; for FP8 and other small formats, the minifloat converter.

Related calculators: IEEE 754 Float Converter, Minifloat Converter, and ULP Explorer.

Frequently Asked Questions

What is the difference between FP16 and bfloat16?

Both use 16 bits, split differently. FP16 (IEEE half precision) has 5 exponent bits and 10 mantissa bits: better precision, about 3 decimal digits, but a maximum of only 65,504. bfloat16 has 8 exponent bits and 7 mantissa bits: the same range as a 32-bit float, up to about 3.4 × 10³⁸, but only 2 to 3 digits.

Why is bfloat16 used for machine learning?

Training neural networks needs range more than precision: gradients can be tiny or huge, and FP16 overflows or underflows unless the loss is scaled. bfloat16 keeps float32’s exponent, so it can be swapped in with almost no changes. Google introduced it for its TPUs, and it is now supported by recent Intel, AMD, Arm and NVIDIA hardware.

How do I convert float32 to bfloat16?

Take the top 16 bits of the float32 and round using the bottom 16: add 0x7FFF plus the lowest kept bit, then shift right by 16. π as a float32 is 0x40490FDB; the bottom half 0x0FDB is less than half, so bfloat16 π is 0x4049 = 3.140625.

How precise is half precision?

FP16 has 11 significant bits (10 stored plus the hidden 1), so the gap between 1 and the next value is 2⁻¹⁰ ≈ 0.000977. Every whole number up to 2,048 is exact; above that it counts in 2s, and from 32,768 in steps of 32. The smallest normal value is about 6.1 × 10⁻⁵.

Where is FP16 used?

In graphics, for textures, HDR images (OpenEXR) and GPU shaders, and in machine-learning inference, where its extra precision helps once the values are known to stay in range. Many GPUs run FP16 maths twice as fast as FP32.

How do I use the FP16 and bfloat16 Converter?

Simply type or paste your value and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.

Do I need to install or sign up for anything?

Not at all — it runs in the browser with nothing to install and no account. After it loads once, it even works without an internet connection.

Is my information private?

Yes. Everything happens in your browser. Nothing you type is sent to a server or saved anywhere.

Common Use Cases

Machine learning

0.1 is 0.0999756 in FP16 but 0.1000977 in bfloat16: FP16 is four times closer.

Range

70,000 overflows FP16 to infinity, but bfloat16 stores it as 70,144.

Graphics

0x3C00 is 1.0 in FP16; 0x3F80 is 1.0 in bfloat16.

Reading tensors

Decode the bf16 pattern 0x4049 as 3.140625, bfloat16 π.

Last updated: