Minifloat / Custom Float Converter — Configurable Exponent & Mantissa Bits

Define your own floating-point format with any number of exponent (E) and mantissa (M) bits and convert a decimal into it. See the sign, exponent (raw, unbiased, bias) and mantissa fields, the full bit string, hex, the value actually stored and the rounding error — with presets for the FP8 ML formats (E4M3, E5M2), FP16, bfloat16, FP32 and FP64. Live, in your browser.

Converter Number Systems Updated Jun 21, 2026
How to Use
  1. Set the exponent bits (E) and mantissa bits (M) — total width is 1 + E + M. The bias defaults to 2^(E−1)−1; override it if you need a non-standard bias.
  2. Or click a preset chip: E4M3 / E5M2 are the FP8 formats used in ML, and E5M10, E8M7, E8M23, E11M52 reproduce FP16, bfloat16, FP32 and FP64.
  3. Type a decimal value (try 0.1, -2, 0.5, or a number above the format max to see overflow → Infinity; “inf” / “nan” work too).
  4. Read the sign / exponent (raw, unbiased, bias) / mantissa fields, the grouped bit string, the hex and the value actually stored — click any value to copy it.
width 8 bits · default bias 7
SignExponentMantissa

One engine for any floating-point width

Every IEEE-style floating-point format is built the same way: 1 sign bit, then E exponent bits, then M mantissa (fraction) bits, for a total width of 1 + E + M. The exponent is stored with a bias so it can represent negative powers without a sign of its own; by convention that bias is 2E−1 − 1, but you can override it. This tool lets you pick E and M for any format — a one-byte minifloat, a research codec, or a familiar standard — and converts a decimal number into it, showing each field, the full grouped bit string, the hex word, the value actually stored after rounding, and the error against what you typed. Load a preset chip to reproduce E4M3 and E5M2 (the FP8 ML formats), or E5M10, E8M7, E8M23 and E11M52 — which are exactly FP16, bfloat16, FP32 and FP64.

Range, precision and the special cases

A normal number reconstructs as (−1)s × 1.m × 2e − bias. The largest finite exponent is emax = 2E − 2 − bias because the all-ones exponent pattern is reserved for Infinity and NaN; push a value past the resulting max finite value and it overflows to ±Infinity. At the small end, when the unbiased exponent would fall below 1 − bias the number becomes a subnormal: the implicit leading 1 is dropped so the format can still represent values down to the smallest subnormal, 21 − bias − M. Adding exponent bits widens the range; adding mantissa bits sharpens the precision. That is the whole trade-off — and why E5M2 reaches further than E4M3 while E4M3 resolves finer steps near 1.

Rounding into the format

The conversion uses round-to-nearest, ties-to-even, the IEEE 754 default. Starting from the exact decimal you entered, the tool finds the unbiased exponent, builds the mantissa to M bits (or fewer for a subnormal), and rounds the bits that don’t fit to the nearest representable value, breaking exact ties toward an even final bit. If the mantissa rounds up past all-ones it carries cleanly into the exponent; if that carry pushes the exponent past emax the result rounds to Infinity. Because the math runs on BigInt internally, arbitrary widths up to 64 bits stay exact — the bits match what conforming hardware would store.

Quick reference

Layout
1 sign · E exp · M mantissa · width 1+E+M
Default bias
2E−1 − 1
Value
(−1)s × 1.m × 2e−bias
Max exponent
emax = 2E − 2 − bias
Smallest subnormal
21 − bias − M
E4M3 · E5M2
the FP8 ML formats (1 byte)
E5M10 · E8M7
= FP16 · bfloat16
±Infinity / NaN
exp all 1s · man 0 / man ≠ 0

About the Minifloat / Custom Float Converter — Configurable Exponent & Mantissa Bits

Minifloat / Custom Float Converter — Configurable Exponent & Mantissa Bits is a quick, free tool for everyday tasks. It works in your browser and keeps everything on your device. Define your own floating-point format with any number of exponent (E) and mantissa (M) bits and convert a decimal into it. See the sign, exponent (raw, unbiased, bias) and mantissa fields, the full bit string, hex, the value actually stored and the rounding error — with presets for the FP8 ML formats (E4M3, E5M2), FP16, bfloat16, FP32 and FP64. Live, in your browser.

How it works

Type a value, then pick what you want to change it into. The answer appears straight away. It all happens on your own device, so it is fast and nothing you type is sent away. Just check that you picked the right “from” and “to” so you get the answer you wanted.

Want the deeper story? The Knowledge Base explains the ideas behind the tools in more detail.

Frequently Asked Questions

What is a minifloat?

A minifloat is a floating-point format that uses very few bits — anything from a handful up to the familiar 16, 32 or 64. It follows the same IEEE 754 rules as a normal float: one sign bit, E exponent bits and M mantissa (fraction) bits, with the stored exponent offset by a bias. The value of a normal number is (−1)^sign × 1.mantissa × 2^(exponent − bias). By choosing E and M yourself you can trade range against precision for a specific use, which is exactly what the FP8 formats do for machine learning.

What are E4M3 and E5M2?

They are the two 8-bit floating-point (FP8) formats standardised for deep learning. E4M3 uses 4 exponent and 3 mantissa bits (bias 7) for a bit more precision and a smaller range; E5M2 uses 5 exponent and 2 mantissa bits (bias 15) for more range and less precision, mirroring the FP16/bfloat16 trade-off one level down. Modern GPUs use them to store weights and activations in just one byte. Note: the exact OCP/Nvidia E4M3 variant tweaks the all-ones exponent so it carries extra finite values and only NaN (no Infinity); this tool uses the plain IEEE-style encoding where the all-ones exponent is reserved for Infinity and NaN.

How is the value rounded into the format?

With round-to-nearest, ties-to-even — the same rule IEEE 754 uses. The tool starts from the exact decimal you typed, finds the unbiased exponent, builds the mantissa to M bits (or fewer, for a subnormal), and rounds the discarded low bits to the nearest representable value, breaking ties toward an even last bit. A mantissa that rounds up past all-ones carries into the exponent; an exponent that grows past the maximum overflows to ±Infinity.

When do I get a subnormal, Infinity or NaN?

The all-ones exponent pattern is reserved: with a zero mantissa it is ±Infinity, with a non-zero mantissa it is NaN. An all-zero exponent with a zero mantissa is ±0; an all-zero exponent with a non-zero mantissa is a subnormal (denormal), which drops the implicit leading 1 and lets the format represent values smaller than the smallest normal number. The tool labels each of these cases and shows the format’s max finite value and its smallest normal and subnormal values.

Is anything uploaded?

No. Every bit pattern is computed in your browser with plain JavaScript (using BigInt so arbitrary widths up to 64 bits work). Nothing is sent to a server.

How do I use the Minifloat / Custom Float Converter — Configurable Exponent & Mantissa Bits?

Just type or paste your value. The answer shows up right away — there is no button to press. Change anything and it updates by itself.

Does it cost anything or need an account?

No. The tool is completely free, there is no account to create, and it keeps working offline after the page first loads.

Is anything I type uploaded?

No. The tool works entirely on your device, so the values you enter never leave your browser.

Common Use Cases

FP8 machine learning

Inspect the exact E4M3 / E5M2 bits used for one-byte weights and activations on modern GPUs and accelerators.

Designing a custom format

Pick E and M for an FPGA, codec or sensor pipeline and immediately see the resulting range, precision and rounding error.

Teaching floating point

Show students how range and precision shift as you add or remove exponent and mantissa bits, including subnormals, Infinity and NaN.

Verifying standard formats

Confirm a value’s FP16, bfloat16, FP32 or FP64 bit pattern by loading the matching preset — the same engine drives every width.

Last updated: