Float to Hex Bits Converter

Enter a number to get its IEEE-754 single and double precision hex representation.

How it is calculated

The number is stored as an IEEE 754 binary float and its bytes are printed in hex, most significant byte first. Single precision uses 32 bits: 1 sign + 8 exponent + 23 fraction, with exponent bias 127. Double precision uses 64 bits: 1 + 11 + 52, bias 1023. A normal value equals (−1)s × 1.f × 2E−bias. The input is first read as a double, then the same value is rounded to the nearest 32-bit float for the single-precision line, so the two lines can differ in precision. Values too large for 32 bits show as infinity (0x7F800000), and values too small show as zero or a subnormal. A decimal comma such as 0,1 is accepted; “1,000” is ambiguous and returns nothing, as does text or a number beyond the 64-bit range.

Worked example

Enter −2.5. The sign bit is 1. Write 2.5 in binary as 10.1, which is 1.01 × 21. The fraction is the bits after the leading 1: 01 followed by zeros. Single precision: exponent 1 + 127 = 128 = 10000000, so the bits are 1 10000000 0100…0, which groups to 1100 0000 0010 0000 … and gives 0xC0200000. Double precision: exponent 1 + 1023 = 1024 = 10000000000, giving 0xC004000000000000. Both are exact, because 2.5 needs only a few fraction bits.

Try this example →

Common mistakes

  • Expecting a decimal such as 0.1 to be stored exactly. Its fraction never ends in binary, so single precision gives 0x3DCCCCCD and double gives 0x3FB999999999999A: the last digit is rounded up in both.
  • Reading the hex as an integer. 0x3F800000 is the float 1.0, not the integer 1065353216 that the same bytes would mean as an int.
  • Mixing up byte order. The tool prints the big-endian, human-readable form; a little-endian memory dump of the same value shows the bytes in reverse.
  • Typing 1,000 for one thousand with a thousands comma. A comma followed by exactly three digits is treated as ambiguous and the tool returns no result; type 1000 instead.
  • Forgetting negative zero. −0 has the sign bit set (0x80000000) and differs from 0 (0x00000000), although they compare equal as numbers.

About this calculator

This converter shows a number's raw IEEE 754 binary representation in hex, for both single precision (32-bit: 1 sign bit, 8 exponent bits, 23 mantissa bits) and double precision (64-bit: 1 sign bit, 11 exponent bits, 52 mantissa bits) — the format almost every modern language and processor uses to store floating-point numbers.

Software engineers use this kind of bit-level view when debugging serialization/deserialization bugs, writing or verifying binary file parsers, checking cross-platform floating-point consistency, or simply understanding why a value like 0.1 can't be represented exactly in binary — a classic source of subtle rounding errors in financial and scientific code.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    The hex is written most significant byte first, which is how you read a bit pattern, but a memory dump on a little-endian machine shows the same bytes reversed. Try 0.1: it gives 0x3DCCCCCD in single and 0x3FB999999999999A in double, and the trailing digits show it is stored as a rounded value, not exactly one tenth. Are you debugging a binary file, a network protocol or a classroom exercise?

Popular calculators

All Calculators