Hero Background

Next-Gen App & Browser Testing Cloud

Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Next-Gen App & Browser Testing Cloud

IEEE 754 Converter

Convert a decimal to half, single or double precision floating point, flip individual bits, and read the exact stored value with its rounding error.

Categories

...

Verify Before You Deploy

Terminal-native web and mobile automation.

Try Kane CLI
...

Write Tests in Plain English with KaneAI

Create, debug, and evolve tests using natural language.

Try for free
...

3000+ Browsers. One Platform.

See exactly how your site performs everywhere.

Try it free
Input
Bit pattern

Click any bit to flip it. Black is the sign bit, the outlined group is the 8 bit exponent and the filled group is the 23 bit mantissa.

Field breakdown

Click a row to copy that value to your clipboard.

The same decimal in all three precisions
binary16 (half, 16 bit), Normal0x2E66Stored as 0.0999755859375, absolute error 0.00002441406250000555
binary32 (single, 32 bit), Normal0x3DCCCCCDStored as 0.100000001490116119384765625, absolute error 1.4901161138336505e-9
binary64 (double, 64 bit), Normal0x3FB999999999999AStored as 0.1000000000000000055511151231257827021181583404541015625, absolute error 0

What is an IEEE 754 converter?

An IEEE 754 converter is a browser tool that encodes a decimal number into the binary floating point layout a CPU actually stores, and decodes a raw bit pattern back into a number. It splits every value into a sign bit, an exponent field and a mantissa field, following IEEE 754-2019.

That standard was published on 22 July 2019 and supersedes IEEE 754-2008. TestMu AI runs the encoder in the page. All processing happens in your browser. No data is uploaded.

For plain integer bases without an exponent field, the Decimal to Binary and Decimal to Hex tools are quicker.

How does IEEE 754 encoding work?

A normal number is stored as (-1)^sign x 1.fraction x 2^(rawExponent - bias). The leading 1 is implied and never stored, which buys one extra bit of precision. The bias is 15 for binary16, 127 for binary32 and 1023 for binary64.

The encoder here works in exact integer arithmetic. It decomposes your decimal into a significand and a power of two, chooses the quantum exponent for the target format, then rounds with round to nearest, ties to even, the default rounding attribute in IEEE 754-2019. That is why the bit pattern matches what your compiler produces.

Two exponent values are reserved. An all zero exponent means zero or a subnormal, where the implicit leading 1 is dropped so values can shrink gradually toward zero. An all ones exponent means infinity when the mantissa is zero and NaN when it is not.

How do you use this IEEE 754 converter?

  • Pick a precision. Choose binary16, binary32 or binary64. The bit grid, the field widths and the exponent bias all change with the selection.
  • Type a decimal number. Enter a value such as 0.1, -273.15 or 6.022e23. You can also type the words NaN, Infinity or -Infinity.
  • Read the bit grid and field breakdown. The grid colors the sign, exponent and mantissa. The table prints the raw and unbiased exponent, the significand and the value class.
  • Flip bits or step by one ULP. Click any bit to toggle it, or use the previous and next buttons to move to the neighbouring representable value.
  • Compare precisions and export. The comparison panel encodes the same decimal in all three formats. Copy any row or download ieee-754-converter.json.
Kane CLI - Testing Agent in Your Terminal

What features does this floating point converter include?

The widget supports three interchange formats, three input modes and a ten row field breakdown where clicking any row copies it. These are the controls you get in this tab:

  • Three precisions: binary16 with a 5 bit exponent, binary32 with 8 and binary64 with 11, each with the correct bias.
  • Three input modes: A decimal field, a raw hex field and a raw binary field, all kept in sync with the bit grid.
  • Clickable bit grid: Every bit is a button, colored by field, so you can flip a single mantissa bit and watch the value move.
  • Exact stored value: The full decimal expansion computed with BigInt arithmetic, not a shortened printout.
  • Rounding error: Absolute and relative error, on one row, between the decimal you typed and the value actually stored.
  • Value class labels: Normal, subnormal, zero, infinity, quiet NaN and signaling NaN are named, not guessed.
  • Sample rotation: One Sample icon cycles through eight edge cases, positive and negative zero, both infinities, NaN, max finite, min subnormal and the classic 0.1.
  • ULP and neighbour stepping: The exact unit in the last place, plus previous and next buttons that move one representable value at a time.
  • Endianness view: One row with the byte sequence in both big endian and little endian order for memory dumps.
  • Precision comparison: The same decimal encoded in all three formats side by side with the absolute error for each.

What is the difference between binary16, binary32 and binary64?

All three share the same sign, exponent and mantissa layout and differ only in field widths. Wider fields buy range and precision at the cost of memory and bandwidth.

binary16 (half)binary32 (single)binary64 (double)
1 sign, 5 exponent, 10 mantissa1 sign, 8 exponent, 23 mantissa1 sign, 11 exponent, 52 mantissa
Bias 15Bias 127Bias 1023
11 bits of precision24 bits of precision53 bits of precision
About 3 decimal digitsAbout 7 decimal digitsAbout 15 to 17 decimal digits
Max finite 65504Max finite about 3.4 times 10^38Max finite about 1.8 times 10^308
GPU weights, HDR pixelsC float, GLSL, audio buffersC double, JavaScript numbers, JSON

JavaScript exposes only binary64, which is why every number literal in a JSON payload lands on the double grid. Inspect the raw bytes of any of these with the Hex to Binary converter, or shift a pattern with the Bit Shift Calculator.

When do developers and testers need an IEEE 754 converter?

Whenever a number crosses a boundary between two systems that store it differently. The common jobs:

  • Explaining a failing equality assertion: Show the exact stored values behind an expected 0.3 that arrived as 0.30000000000000004.
  • Reading a memory dump or packet capture: Paste four or eight bytes of hex and get the float back with its value class.
  • Porting code between float and double: The comparison panel shows what precision you lose before you change the type.
  • Writing tolerance based test assertions: The ULP row gives you a defensible epsilon instead of a guessed 0.0001.
  • Debugging machine learning quantisation: binary16 mode shows exactly where a weight rounds when a model is cast to half precision.
  • Teaching computer architecture: Flipping a single exponent bit and watching the magnitude double makes the layout concrete.

Rounding defects usually surface as flaky numeric assertions. Group and triage those runs in TestMu AI Test Intelligence, and confirm the same arithmetic across engines on Real Device Cloud with 10,000+ real devices and 3000+ browsers. To check a two's complement integer instead, use the Binary Calculator.

Frequently Asked Questions (FAQs)

Why is 0.1 not stored exactly in IEEE 754?

Because 0.1 is 1/10 and 10 has the prime factor 5, which no power of two can express. Binary can only represent fractions whose denominator is a power of two, so 0.1 becomes a repeating binary fraction that gets cut off. In binary32 the nearest stored value is 0.100000001490116119384765625.

Why does 0.1 plus 0.2 not equal 0.3?

Each operand is already rounded before the addition happens, and the sum is rounded again. In binary64 the result is 0.3000000000000000444089209850062616169452667236328125, which prints as 0.30000000000000004. Encode 0.1, 0.2 and 0.3 in this tool and compare the exact stored values to see the gap.

What is the difference between single and double precision?

binary32 uses 1 sign bit, 8 exponent bits and 23 mantissa bits, giving 24 bits of precision and about 7 decimal digits. binary64 uses 1 sign bit, 11 exponent bits and 52 mantissa bits, giving 53 bits of precision and about 15 to 17 decimal digits. Both are defined in IEEE 754-2019.

What is the exponent bias in IEEE 754?

The bias is a constant added to the real exponent so the stored field is always a non negative integer. It is 15 for binary16, 127 for binary32 and 1023 for binary64. Subtract the bias from the raw exponent field to get the real power of two, which this tool prints on the exponent row.

What is a subnormal or denormal number?

A subnormal number has an all zero exponent field and a non zero mantissa. The implicit leading 1 is dropped and the exponent is fixed at the minimum, which lets values smaller than the smallest normal shrink gradually toward zero. This behaviour is called gradual underflow and it avoids a sudden jump to zero.

How does IEEE 754 represent NaN and infinity?

Both use an all ones exponent field. If the mantissa is zero the value is infinity, with the sign bit choosing positive or negative. If the mantissa is non zero the value is NaN, and the top mantissa bit distinguishes a quiet NaN from a signaling NaN. This tool labels each case on the value class row.

Why does IEEE 754 have both positive and negative zero?

The sign bit is stored separately from the magnitude, so a zero magnitude can carry either sign. They compare as equal, but they behave differently in division: 1 divided by positive zero is positive infinity, while 1 divided by negative zero is negative infinity. The sign also survives through operations that underflow.

What rounding mode does this IEEE 754 converter use?

Round to nearest, ties to even, which is the default rounding attribute in IEEE 754-2019. When a decimal sits exactly halfway between two representable values the encoder picks the one with an even last mantissa bit. That is the same rule your CPU applies, so the bit pattern matches what your program would store.

What is a ULP in floating point?

A ULP is the unit in the last place, the gap between one representable number and the next at that magnitude. It doubles every time the exponent increases, so precision is dense near zero and sparse near the maximum. The tool prints the exact ULP for the current value and lets you step one ULP at a time.

Can I decode a hex value back into a float?

Yes. Paste the raw hex into the hex field, for example 3DCCCCCD in binary32 mode, and the decimal, bit grid and field breakdown all update. The raw binary field accepts the same value as a bit string. Both directions use the same encoder, so a round trip returns the original pattern.

Should I use float or decimal for money?

Use a decimal or integer minor unit type for money. Binary floating point cannot store 0.01 or 0.1 exactly, so repeated addition accumulates a visible error. Store amounts as integer cents, or use a decimal type such as SQL NUMERIC, and reserve binary floating point for measurements and scientific values.

What is the largest number a double can hold?

The largest finite binary64 value is about 1.7976931348623157 times 10 to the power 308, stored as 7FEFFFFFFFFFFFFF. Anything larger rounds to infinity. Press the Sample icon until Max finite loads to read that exact bit pattern and its full decimal expansion.

Why do 32 bit and 64 bit give different results for the same decimal?

They round the same real number to different grids. binary32 has 24 bits of precision and binary64 has 53, so the nearest representable neighbour differs. The precision comparison panel encodes your decimal in all three formats at once and prints the absolute error for each so the tradeoff is visible.

KaneAI - GenAI-Native Testing Agent

Did you find this page helpful?

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests