How to use the floating-point converter
Encode a number
Choose Number to bits and hex, select float32 or float64, and enter a decimal value. The browser writes the JavaScript number into a DataView using the selected IEEE 754 binary format. The page then displays the stored value, complete bit string, hexadecimal bytes, sign, exponent, fraction, and value class.
Decode bits or hexadecimal
Choose Bits or hex to number. Float32 requires exactly 32 binary digits or 8 hexadecimal digits; float64 requires 64 bits or 16 hex digits. A leading 0x is optional, and spaces or underscores may separate groups. The displayed bytes are big-endian: the most-significant byte appears first.
Understand the fields
The first bit is the sign. Float32 uses 8 exponent bits and 23 fraction bits with bias 127; float64 uses 11 exponent bits and 52 fraction bits with bias 1023. All-zero exponent fields represent zero or subnormal values. All-one exponent fields represent infinity or NaN, depending on the fraction.
Expect rounding
JavaScript first parses decimal input as its Number type. Encoding as float32 can round again to 24 bits of binary precision; float64 uses the JavaScript binary64 value already parsed. The converter reveals that stored representation but cannot recover decimal digits discarded before conversion or provide arbitrary-precision decimal arithmetic.
Known examples
Float32 value 1
The number 1 encodes as bits 00111111100000000000000000000000 and hex 0x3F800000. Sign is 0, exponent is 01111111, and the fraction is all zeros.
Special values and rounding
Float32 -0 is 0x80000000, positive infinity is 0x7F800000, and the smallest positive subnormal is 0x00000001. Encoding π as float32 returns about 3.1415927410125732 because the exact decimal value is rounded to the nearest available float32 value.
Limits and exactness
- This tool inspects IEEE 754 interchange representations through standard browser DataView operations. It is not an arbitrary-precision calculator, decimal-preservation service, memory inspector, or file parser.
- NaN has many legal payload bit patterns. Encoding the text NaN uses the browser’s canonical representation, while decoding preserves and displays the exact entered bit pattern. Numeric output remains simply NaN.
- The binary and hex displays use big-endian byte order for readability and interchange. Host memory byte order is not claimed. Decimal-to-float ties and overflow follow JavaScript/DataView conversion behavior.
Frequently asked questions
Why does float32 change my decimal?
Most decimal fractions cannot be represented exactly in binary, and float32 has fewer precision bits than JavaScript Number.
Are +0 and -0 different?
They compare similarly in many calculations but have different sign bits. This converter preserves and labels -0.
Can I enter a NaN payload?
Yes in decode mode by entering exact bits or hex. Encode mode accepts only the general NaN numeric value.
What does big-endian display mean?
The leftmost byte contains the highest-order sign and exponent bits. This is an explicit display order, independent of host memory layout.