IEEE 754 Float Converter
Convert decimal values, hexadecimal bit patterns, and binary bit strings between float32 single precision and float64 double precision, with sign, exponent, and mantissa breakdowns.
FreeOnline Tool
Loading…
How to Use
The three inputs stay in sync: edit any one field and the other two representations update automatically.
- Choose the precision: single-precision float32 (32 bits) or double-precision float64 (64 bits).
- Enter a decimal value in the decimal field, including scientific notation (such as
1e-10) andNaN,Infinity, or-Infinity. You can also type a hex bit pattern with or without a0xprefix, or a binary string with optional space grouping. - Read the bit-field visualization: red is the sign bit, blue the exponent, green the mantissa, followed by the stored exponent, bias, and actual exponent.
- Use the “Load” buttons in the special-values table to fill in +0, -0, ±Infinity, NaN, π, MAX, MIN_NORMAL, and the smallest subnormal.
- Click “Copy” next to a result row to copy that representation. “Load sample” restores 3.14159 in float32 mode, and “Clear” empties all inputs.
Features
- Two precisions: float32 uses an 8-bit exponent, 23-bit mantissa, and bias 127; float64 uses 11 exponent bits, 52 mantissa bits, and bias 1023. Switching precision recomputes from the active input.
- Three-way conversion: enter decimal, hexadecimal, or binary and get the other two forms. Hex and binary input may be shorter than the full width and is left-padded with zeros.
- Bit-field breakdown: shows every sign, exponent, and mantissa bit plus the stored value, bias, and actual exponent. Subnormal numbers are labeled as having no implicit leading 1.
- Special-value detection: recognizes +0, -0, +Infinity, -Infinity, and NaN and shows a badge next to the result heading.
- Reference table: lists zero, infinities, NaN, 1.0, 2.0, π, the largest finite value, the smallest normal, and the smallest subnormal for the selected precision, each loadable with one click.
- Local computation: conversion uses the browser DataView API and sends no data to a server.
Use Cases
Debug embedded register values
Paste a float32 register value read from a sensor as hex and inspect the sign, exponent, and mantissa to tell a normal value from an overflow, subnormal, or NaN.
Check floating-point precision loss
Convert the same decimal number in float32 and float64 and compare the stored value with the original to judge whether single precision is sufficient.
Analyze protocol and binary payloads
Enter a hex pattern with 0x prefix or a binary string to get a readable decimal value and a bit-by-bit breakdown for checking floating-point fields in a communication protocol.
Teach IEEE 754 encoding
Load +0, -0, Infinity, NaN, and the smallest subnormal from the reference table to demonstrate how the standard encodes special values.
FAQ
What decimal formats are accepted?
Ordinary decimals, an optional sign, scientific notation such as 3.14e-10, and the special tokens NaN, Infinity, -Infinity (inf and -inf also work). Empty or malformed input shows an error message.
Why can hex or binary input be shorter than full width?
The tool accepts 1–8 hex digits for float32 and 1–16 for float64, or 1–32 and 1–64 binary digits respectively, padding on the left with zeros. Input longer than the selected precision is rejected with an error.
Why can the displayed value differ between decimal and bit-pattern input?
When you type a decimal, the result is rounded to the selected precision and the decimal field keeps your original text. When you enter hex or binary, the decimal field shows the exact value decoded from that bit pattern. For example, π stored as float32 is actually 3.1415927.
How are subnormal numbers handled?
When the exponent field is all zeros but the mantissa is not, the value is subnormal: there is no implicit leading 1 and the actual exponent is 1 - bias. The bit-field legend labels this case, and the numeric value comes from the DataView decode.
What byte order is used for the bit pattern?
The tool reads and writes with DataView in big-endian order, matching common IEEE 754 online converters and network byte order. float64 is split into high and low 32-bit halves so no bits are lost.
Does the converter upload data or call a server?
No. All parsing and formatting run locally in the browser using DataView and the clipboard API. Apart from copy, the tool works offline in current browsers.