FP16 / bfloat16 Converter — Half-Precision & Brain Float Bits
Convert a decimal number to both IEEE half-precision (FP16) and bfloat16 (brain float) at once. See the sign, exponent (raw bits, unbiased value, bias) and mantissa fields, the 16-bit binary, the hex, the value actually stored, and the rounding error — live in your browser.
How to Use
- Type a decimal number (try 0.1, -2, 0.5, 70000 to see FP16 overflow, or “inf” / “nan”).
- Compare the two formats side by side — FP16 (5-bit exponent) and bfloat16 (8-bit exponent).
- For each, read the sign, exponent (raw bits, unbiased value, bias) and mantissa, plus the grouped 16-bit binary and hex.
- Check “Value stored” and “Rounding error” to see how exactly your number fits — click any value to copy it.
Two ways to spend 16 bits
When you only have 16 bits to store a floating-point number, you have to choose between range and precision. FP16 (IEEE half precision) spends them as 1 sign + 5 exponent + 10 mantissa bits with a bias of 15: lots of fraction bits for precision, but a tiny exponent that caps the largest finite value near 65,504. bfloat16 (“brain float”, from Google Brain) instead keeps the full 8-bit exponent of a 32-bit float — 1 sign + 8 exponent + 7 mantissa, bias 127 — so it spans the same enormous range as a regular float but with far coarser precision. This converter shows both at once so you can see exactly how the same decimal number lands in each. Everything is computed in your browser with a DataView over typed arrays, so the bits match what hardware would store.
Rounding, overflow and why ML uses bfloat16
Both formats reconstruct a value as (-1)sign × 1.mantissa × 2exponent − bias and round with round-to-nearest, ties-to-even. Because bfloat16 is literally the top half of a float32, converting to it is just keeping the high 16 bits and rounding the discarded low 16 — which means a float32 and its bfloat16 truncation share the same exponent, so values rarely overflow. FP16 must rebias the exponent from 127 down to 15 and squeeze the mantissa from 23 bits to 10; when the resulting exponent is too large the number overflows to ±Infinity (try 70000), and when it is too small the number becomes a subnormal. That trade-off is why modern machine-learning hardware favours bfloat16: gradients and activations during training can swing across many orders of magnitude, and bfloat16’s wide range avoids overflow without needing a full 32-bit float.
Special values and bit fields
As in any IEEE 754 format, a few exponent patterns are reserved. An all-zero exponent with an all-zero mantissa is zero (and the sign bit gives both +0 and −0); an all-zero exponent with a non-zero mantissa is a subnormal. An all-ones exponent with a zero mantissa is ±Infinity, and with a non-zero mantissa it is NaN. The tool labels each case and breaks out the sign bit, the exponent (as raw bits, as its unbiased value, and showing the bias), and the mantissa, alongside the grouped 16-bit binary, the hex word, the value actually stored, and the rounding error against what you typed.
Quick reference
About the FP16 / bfloat16 Converter — Half-Precision & Brain Float Bits
Working on everyday tasks? The FP16 / bfloat16 Converter — Half-Precision & Brain Float Bits is a free browser tool that gives you the answer in seconds. Convert a decimal number to both IEEE half-precision (FP16) and bfloat16 (brain float) at once. See the sign, exponent (raw bits, unbiased value, bias) and mantissa fields, the 16-bit binary, the hex, the value actually stored, and the rounding error — live in your browser.
How it works
Enter a number and choose your units — the converted value shows instantly. Everything runs locally, so nothing you type leaves your device. Double-check the direction of the conversion and you are set.
Want the deeper story? The Knowledge Base explains the ideas behind the tools in more detail.
Frequently Asked Questions
What is the difference between FP16 and bfloat16?
Both are 16-bit floating-point formats, but they split those bits differently. IEEE half precision (FP16) uses 1 sign, 5 exponent and 10 mantissa bits with a bias of 15, giving more precision but a small range that tops out near 65,504. bfloat16 (brain float) uses 1 sign, 8 exponent and 7 mantissa bits with a bias of 127 — exactly the same exponent range as a 32-bit float, so it almost never overflows, at the cost of precision. That wide range is why bfloat16 is popular for training neural networks.
Why does 70000 become Infinity in FP16 but not bfloat16?
FP16 has only a 5-bit exponent, so its largest finite value is about 65,504. Anything bigger overflows to ±Infinity. bfloat16 keeps the 8-bit exponent of a normal 32-bit float (max ≈ 3.4×10³⁸), so 70,000 stays finite — it just loses precision in its 7-bit mantissa. The tool labels the FP16 overflow case for you.
Why isn’t 0.1 stored exactly?
Like all binary floating point, these formats store fractions in base 2, and 0.1 has no finite binary expansion. The nearest FP16 value is 0x2E66 ≈ 0.0999755859375; the nearest bfloat16 is 0x3DCD ≈ 0.100097656. With only 10 (FP16) or 7 (bfloat16) mantissa bits the rounding error is far larger than with a 32- or 64-bit float — the “Rounding error” card shows it directly.
How is the conversion rounded?
Both use round-to-nearest, ties-to-even — the same rule IEEE 754 uses. bfloat16 is computed by taking the top 16 bits of the float32 pattern and rounding the discarded low 16 bits; FP16 rebiases the exponent from 127 to 15, truncates the mantissa from 23 to 10 bits with the same tie-break, and handles subnormals and overflow. Everything runs with typed arrays in your browser, so the bits match what hardware would store.
Is anything uploaded?
No. The bit patterns are computed entirely in your browser with a DataView over typed arrays. Nothing is sent to a server.
How do I use the FP16 / bfloat16 Converter — Half-Precision & Brain Float Bits?
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 & GPUs
Inspect the exact FP16 or bfloat16 bits used for model weights, activations and mixed-precision training on modern GPUs and TPUs.
Choosing a 16-bit format
See the range-vs-precision trade-off side by side: bfloat16’s huge range against FP16’s extra mantissa bits.
Low-level & embedded work
Grab the 16-bit hex pattern for firmware, GPU buffers, memory dumps or a binary file.
Learning half precision
Understand sign / exponent / mantissa, the exponent bias, subnormals, FP16 overflow to Infinity, and NaN in compact 16-bit formats.
Last updated: