Skip to content

Floating-Point Bits and Hex Converter

Encode a number as IEEE 754 float32/64, or decode an exact binary or hexadecimal bit pattern.

Choose a direction and format

Processed in your browser.

Decimal, scientific notation, Infinity, -Infinity, NaN, or -0. Enter exactly 32/64 binary digits or 8/16 hexadecimal digits; 0x, spaces, and underscores are allowed.

IEEE 754 representation

Choose a format, enter a value or bit pattern, then convert.

Stored numeric value1
Sign bitExponent bitsFraction bits
0
01111111
00000000000000000000000

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

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.