Minifloat Converter (FP8, FP6, FP4)
Convert numbers to and from tiny floating-point formats. FP8 E4M3 and E5M2, the FP6 and FP4 formats used in AI hardware, or any custom layout, with every possible value drawn on a number line.
How to Use
- Pick a format: FP8 E4M3 or E5M2, FP6 E2M3 or E3M2, FP4 E2M1, or Custom to set your own exponent and mantissa bits.
- Choose number to bits or bits to number.
- Type a number such as 0.3, or a bit pattern in hex or binary.
- Read the bits, the hex code, the value actually stored and the error.
- The number line shows every value the format can hold, so you can see how coarse it is.
Worked Example
0.3 in FP8 E4M3. The bias is 2³ − 1 = 7. 0.3 = 1.2 × 2⁻², so the exponent field is −2 + 7 = 5 = 0101. The mantissa has 3 bits: 0.2 × 8 = 1.6, rounded to 2 = 010. The code is 0 0101 010 = 0x2A, which is exactly (1 + 2/8) × 2⁻² = 0.3125, an error of +0.0125 (4%).
FP4 E2M1 has only eight sizes. With a sign, 2 exponent bits and 1 mantissa bit, the positive values are 0, 0.5, 1, 1.5, 2, 3, 4 and 6. 2.5 lies exactly halfway between 2 (mantissa 0) and 3 (mantissa 1), and ties go to the even mantissa, so it is stored as 2.
The common mistake: forgetting the range. E4M3’s largest value is 448. A value of 1,000 does not become infinity, because the format has none: it saturates to 448, or becomes NaN on hardware that does not saturate. Data has to be scaled into range before it is cast to FP8.
Show Work
Formulas
Smaller and Smaller Floats
Tiny floating-point formats were once only a teaching device: textbooks used 6- and 8-bit “minifloats” because all of their values fit on one page. Deep learning made them practical. In 2022 NVIDIA, Arm and Intel proposed the two FP8 formats, E4M3 and E5M2, and NVIDIA’s Hopper GPUs implemented them; the Open Compute Project then standardised FP8 and, in its microscaling (MX) specification of 2023, FP6 and FP4 with a shared 8-bit scale per block of 32 values.
With so few bits, every design choice shows. E4M3 drops infinity to buy one more doubling of range; the MX formats drop NaN as well; and subnormals take a large share of the codes. The number line on this page makes those trade-offs visible: the values crowd together near zero and spread out towards the maximum.
About This Calculator
This converter encodes numbers into FP8 (E4M3 and E5M2), FP6 (E2M3 and E3M2), FP4 (E2M1) or a custom IEEE-style format with your choice of exponent and mantissa bits, and decodes their bit patterns. It shows the bits, the value stored and the rounding error, the format’s largest, smallest and epsilon, and draws every representable value on a logarithmic number line.
Everything runs in your browser; nothing is sent anywhere. Rounding is to nearest, ties to even, and the OCP formats saturate on overflow.
Related calculators: FP16 and bfloat16 Converter, IEEE 754 Float Converter, and Posit Converter.
Frequently Asked Questions
What is the difference between E4M3 and E5M2?
Both are 8-bit floats with a sign bit. E4M3 has 4 exponent bits and 3 mantissa bits: more precision but a range of only ±448. E5M2 has 5 and 2: less precision but a range of ±57,344. Training often uses E4M3 for weights and activations and E5M2 for gradients, which need range more than precision.
Why does E4M3 have no infinity?
With only 8 bits, every code matters. The OCP FP8 specification gives up infinity and keeps a single NaN pattern (S.1111.111), so the codes that would have been infinity and the other NaNs become extra finite values. That is why the largest E4M3 value is 448 rather than 240.
What are FP6 and FP4?
Even smaller formats from the Open Compute Project’s microscaling (MX) specification. FP4 E2M1 has just 16 codes: ±0, 0.5, 1, 1.5, 2, 3, 4 and 6. They are used with a shared scale factor for each block of 32 numbers, which restores the range that 4 or 6 bits cannot hold on their own.
How are values rounded?
To the nearest representable value, and on a tie to the one whose last mantissa bit is 0 (round half to even). In FP4, 2.5 lies exactly between 2 and 3, so it rounds to 2. Values above the largest saturate to the maximum in the OCP formats, as most hardware does, or overflow to infinity in IEEE-style ones.
Why use such low precision?
Speed and memory. Halving the bits halves the memory traffic and roughly doubles the arithmetic throughput, which matters most for running and training large neural networks. Their weights tolerate coarse rounding surprisingly well, especially with per-block scaling.
How do I use the Minifloat Converter (FP8, FP6, FP4)?
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 training
0.3 is 0x2A in E4M3 and 0x35 in E5M2, both really 0.3125.
Range
E4M3 stops at 448 and E5M2 at 57,344; 1,000 saturates in E4M3.
FP4 quantization
E2M1 holds only 0, 0.5, 1, 1.5, 2, 3, 4 and 6; 2.5 rounds to 2.
Teaching
Build a custom 8-bit E3M4 float and see all of its values on one line.
Last updated: