ToolSphere

IEEE 754 Converter

Computer science

Convert decimal numbers to single and double precision IEEE 754 float bits and back from hex. See sign, exponent, mantissa, rounding, and homework steps.

Convert decimal numbers to 32-bit single precision and 64-bit double precision IEEE 754 floating-point format and back from hexadecimal or binary bit patterns. Inspect sign, biased and unbiased exponents, mantissa bits, exact stored values, rounding errors, and step-by-step conversion traces.

IEEE 754 Representation

Normal (finite normalized number)32-bit Float
Hex:0xC15A0000

Stored Float Value

-13.625

Sign: 1 (Negative) · Biased exp: 130 · Unbiased exp: 2^3 · Status: Exact

Bit Layout (32 bits)

Sign (1b)1Exponent (8b)10000010Mantissa (23b)10110100000000000000000
Exact Stored Decimal Value:

-13.625

Supports standard decimals, integers, negative numbers, scientific notation (e.g. 1e-40), ±0, Infinity, and NaN.

Preset Homework & Exam Examples

Standard: IEEE 754-2008 / IEEE 754-2019

Step-by-Step Conversion (Show Your Work)

Homework solution format

Step 1: Determine the sign bit (S)

The input -13.625 is negative. IEEE 754 represents negative numbers with a sign bit of S = 1. Unlike two's complement integer arithmetic, floating-point numbers use signed-magnitude encoding, so only the sign bit indicates polarity.

Sign bit (S) = 1 (Negative)

Step 2: Convert the integer part to binary

Convert the integer part 13 to binary by repeated division by 2, reading remainders from bottom to top: 13 ÷ 2 = 6 remainder 1 6 ÷ 2 = 3 remainder 0 3 ÷ 2 = 1 remainder 1 1 ÷ 2 = 0 remainder 1 Result: 13_10 = 1101_2.

Integer part = 13 -> 1101_2

Step 3: Convert the fractional part to binary

Convert fractional part 0.625000 by repeated multiplication by 2, recording each integer bit: 0.6250 × 2 = 1.2500 -> bit 1, remainder 0.2500 0.2500 × 2 = 0.5000 -> bit 0, remainder 0.5000 0.5000 × 2 = 1.0000 -> bit 1, remainder 0.0000 The remainder reached 0 (terminating binary fraction: .101_2).

Step 4: Normalize to binary scientific notation (1.f × 2^E)

Shift the binary point so that exactly one non-zero bit (the leading 1) is to the left of the point. The shift distance determines the unbiased exponent E.

Normalized form: 1.10110100... × 2^(3)
Unbiased exponent E = 3

Step 5: Calculate the biased exponent (bias = 127)

IEEE 754 adds a fixed bias to the exponent so the stored exponent is always an unsigned non-negative integer. This allows fast hardware comparison of floating-point magnitudes using integer circuitry. Biased exponent e = E + bias = 3 + 127 = 130. Convert 130 to an 8-bit unsigned binary number.

Biased exponent (e) = 130 = 10000010_2

Step 6: Extract the 23-bit mantissa (fraction) field

Drop the implicit leading 1 (the "hidden bit") and retain the 23 fraction bits. If the fraction exceeds 23 bits, IEEE 754 default "Round to Nearest, Ties to Even" rounds the least significant bit.

Mantissa (23 bits) = 10110100000000000000000
Hidden leading bit = 1

Step 7: Assemble the complete IEEE 754 word and convert to Hex

Concatenate the sign bit (1 bit), biased exponent (8 bits), and mantissa (23 bits). Then group into 4-bit nibbles to write in hexadecimal.

Sign: 1
Exponent: 10000010
Mantissa: 10110100000000000000000
Hex: 0xC15A0000
Exact Decimal Stored: -13.625

On this browser only

Give feedback

Did this tool help?

Tell us what worked, what didn’t, or what you’d like next.

Opens Google Forms in a new tab with this tool’s name filled in. No sign-in or email required. Feedback is optional.

How to use IEEE 754 Converter

  1. 1Select your conversion mode: Decimal to IEEE 754 or Hex/Binary to IEEE 754.
  2. 2Choose your precision standard: Single Precision (32-bit binary32) or Double Precision (64-bit binary64).
  3. 3Enter a decimal number (such as -13.625, 0.1, or 1e-40) or paste a hexadecimal string (like C15A0000).
  4. 4Inspect the highlighted sign, exponent, and mantissa fields alongside the exact stored base-10 value and rounding error.
  5. 5Follow the Step-by-Step Conversion trace below the tool to verify homework steps, normalization, bias addition, and rounding.

About IEEE 754 Converter

Understanding the IEEE 754 floating-point standard

The IEEE 754 standard (originally ratified in 1985 and updated in 2008 and 2019) governs how modern microprocessors, GPUs, and programming languages store real numbers in binary hardware registers. Because computers have finite memory, continuous real numbers must be mapped into fixed-width bit patterns.

Every finite IEEE 754 floating-point number is represented in binary scientific notation using three distinct components:

  1. Sign bit (S): 1 bit indicating positive (0) or negative (1).
  2. Biased Exponent (e): Stored using excess-bias encoding (bias = 127 for 32-bit single precision; bias = 1023 for 64-bit double precision).
  3. Mantissa or Fraction (f): Encodes the fractional bits after the binary point.

In normalized format, the value is evaluated as:
Value = (-1)^S × (1 + f) × 2^(e - bias)

Why floating-point hardware uses biased exponents

In integer arithmetic, computers commonly use two's complement to represent signed numbers. However, IEEE 754 uses biased (excess) representation for exponents. Adding a fixed bias (127 for single precision, 1023 for double precision) shifts negative exponents into non-negative integers. For example, an unbiased exponent of -4 becomes a stored biased exponent of -4 + 127 = 123 in single precision.

This design enables high-performance hardware execution:

  • Comparing two positive floating-point numbers can be performed using standard unsigned integer comparator circuits without first extracting or decoding the sign of the exponent.
  • Lexicographical ordering is preserved across finite normalized numbers, dramatically accelerating sorting algorithms and hardware ALU pipeline stages.

The implicit leading 1: gaining an extra bit of precision

In base-10 scientific notation, numbers are normalized so that exactly one non-zero digit precedes the decimal point (for example, 3.14 × 10^0). In base 2, the only non-zero binary digit is 1. Therefore, every normalized binary number begins with 1 (for example, 1.1011 × 2^3).

Because the leading bit is guaranteed to be 1 for all normalized numbers, IEEE 754 architects chose not to store this bit in memory. It is treated as an implicit "hidden bit." This clever architectural choice grants 24 bits of significand precision while storing only 23 mantissa bits in single precision, and 53 bits of precision from 52 stored bits in double precision.

Worked Example 1: Converting -13.625 to 32-bit single precision

Consider the classic computer architecture homework problem: convert -13.625 into IEEE 754 single precision.

  1. Sign bit: The number is negative, so sign bit S = 1.
  2. Integer portion to binary: Convert 13 to binary by repeated division by 2:
    • 13 ÷ 2 = 6 remainder 1
    • 6 ÷ 2 = 3 remainder 0
    • 3 ÷ 2 = 1 remainder 1
    • 1 ÷ 2 = 0 remainder 1
      Reading remainders from bottom to top yields 13_10 = 1101_2.
  3. Fractional portion to binary: Convert 0.625 to binary by repeated multiplication by 2:
    • 0.625 × 2 = 1.250 -> bit 1, remainder 0.250
    • 0.250 × 2 = 0.500 -> bit 0, remainder 0.500
    • 0.500 × 2 = 1.000 -> bit 1, remainder 0.000 (terminates)
      Reading top-down yields 0.625_10 = 0.101_2.
  4. Combine and normalize:
    13.625_10 = 1101.101_2.
    Shift the binary point 3 places to the left: 1.101101_2 × 2^3.
    The unbiased exponent E is 3.
  5. Biased exponent:
    e = E + bias = 3 + 127 = 130.
    Convert 130 to 8-bit unsigned binary: 130 = 128 + 2 = 10000010_2.
  6. Mantissa field:
    Drop the implicit leading 1 to get the fraction bits: 101101_2.
    Pad with trailing zeros to fill the 23-bit mantissa:
    10110100000000000000000_2.
  7. Assemble the 32-bit word:
    • Sign (1 bit): 1
    • Exponent (8 bits): 10000010
    • Mantissa (23 bits): 10110100000000000000000
      Concatenated: 1100 0001 0101 1010 0000 0000 0000 0000_2.
      Group into 4-bit nibbles: 0xC15A0000.
      Because 0.625 is an exact sum of negative powers of two (2^-1 + 2^-3 = 0.5 + 0.125), the exact stored value is -13.625 with zero rounding error.

Worked Example 2: Why 0.1 produces floating-point rounding error

A common pitfall in software engineering is the assumption that 0.1 can be stored exactly. Just as 1/3 cannot be represented as a finite terminating decimal in base 10 (0.3333...), the fraction 0.1 cannot be represented as a finite terminating binary fraction in base 2:

  • 0.1 × 2 = 0.2 -> 0
  • 0.2 × 2 = 0.4 -> 0
  • 0.4 × 2 = 0.8 -> 0
  • 0.8 × 2 = 1.6 -> 1
  • 0.6 × 2 = 1.2 -> 1
  • 0.2 × 2 = 0.4 -> 0 (repeats pattern 0011 indefinitely)

0.1_10 = 0.0001100110011..._2 = 1.1001100110011001100110011..._2 × 2^-4.
The unbiased exponent is -4, so the biased exponent is -4 + 127 = 123 = 01111011_2.
When truncating to 23 mantissa bits, the dropped bits begin with 1100...
Under the default IEEE 754 "Round to Nearest, Ties to Even" mode, the value rounds upward by adding 1 to the least significant bit:
Stored mantissa: 10011001100110011001101_2.
Assembled 32-bit float: 0x3DCCCCCD.
Converting these exact stored bits back into base 10 yields 0.100000001490116119384765625.
The absolute rounding error is approximately +1.490116 × 10^-9.

Special values: zeros, subnormals, infinities, and NaN

IEEE 754 reserves specific bit patterns for boundary cases:

  • Signed zeros (+0 and -0): Biased exponent e = 0 and mantissa = 0. Preserving sign allows directional limits in calculus (such as 1 / -0 = -Infinity).
  • Subnormal (denormal) numbers: Biased exponent e = 0 and mantissa ≠ 0. The implicit leading bit becomes 0, and the effective exponent is fixed at 1 - bias (-126 for single precision). This provides gradual underflow, preventing catastrophic underflow when subtracting nearly equal small numbers.
  • Infinities (+Infinity and -Infinity): Biased exponent e = all 1s (255 or 2047) and mantissa = 0. Produced by overflow or division by zero.
  • NaN (Not a Number): Biased exponent e = all 1s and mantissa ≠ 0. Indicates mathematically undefined operations like 0 / 0 or sqrt(-1). Quiet NaNs (qNaN) propagate silently through arithmetic pipelines, while signaling NaNs (sNaN) trigger CPU traps.

Guides and tutorials

Frequently asked questions

What is the difference between single precision and double precision?

Single precision (binary32) uses 32 bits total (1 sign bit, 8 exponent bits, 23 mantissa bits) with a bias of 127, providing about 7 decimal digits of precision. Double precision (binary64) uses 64 bits total (1 sign bit, 11 exponent bits, 52 mantissa bits) with a bias of 1023, providing about 15 to 17 decimal digits of precision and a much wider dynamic range.

Why does 0.1 have a rounding error in IEEE 754 floating point?

Because base-10 fractions with prime factors other than 2 cannot terminate in binary. The fraction 1/10 in binary is an infinite repeating pattern (0.0001100110011..._2). When cut off at 23 mantissa bits in single precision, it is rounded to 0x3DCCCCCD, which evaluates in exact decimal to 0.100000001490116119384765625.

Why does IEEE 754 use a biased exponent instead of two's complement?

Biased representation shifts negative exponents to non-negative unsigned integers (e.g. adding 127 in single precision). This guarantees that for two positive normalized floating-point numbers, the one with the larger value also has a larger numerical bit representation. Hardware can compare and sort floats using simple, fast unsigned integer comparator circuits without extracting exponent signs.

What is the hidden bit (implicit leading 1) in normalized numbers?

In binary scientific notation, every non-zero normalized number starts with a 1 before the binary point (e.g., 1.1011 × 2^3). Because this bit is always 1, IEEE 754 does not store it in memory. Hardware automatically restores the leading 1 during calculations, effectively gaining one extra bit of precision for free (24 bits total precision from 23 stored mantissa bits).

What are subnormal (denormalized) numbers and why are they needed?

Subnormal numbers represent values closer to zero than the smallest normalized positive float (2^-126 ≈ 1.175 × 10^-38 in single precision). They are identified by an exponent of all zeros and a non-zero mantissa. For subnormals, the implicit leading bit is 0 instead of 1, and the effective exponent is fixed at 1 - bias (-126). This enables gradual underflow, ensuring that a - b == 0 if and only if a == b.

Why does IEEE 754 include both positive zero (+0) and negative zero (-0)?

Signed zeros preserve sign information under underflow and directional operations. While +0 and -0 compare as equal in arithmetic comparisons (+0 == -0 is true), they behave differently in operations like division: 1.0 / +0.0 yields +Infinity, while 1.0 / -0.0 yields -Infinity. This distinction is critical for evaluating limits and complex functions with branch cuts.

What is the difference between quiet NaN (qNaN) and signaling NaN (sNaN)?

Both represent undefined mathematical operations (like 0 / 0 or sqrt(-1)) with an exponent of all 1s and a non-zero mantissa. In single precision, a quiet NaN sets the most significant mantissa bit (bit 22) to 1, allowing it to propagate through arithmetic operations without raising a hardware exception. A signaling NaN clears bit 22 and sets other mantissa bits, causing the CPU to raise an invalid operation trap immediately.

What is IEEE 754 round to nearest, ties to even?

Round to nearest, ties to even (also known as unbiased rounding or banker's rounding) is the default rounding mode in IEEE 754. If excess bits fall midway between two representable floating-point values, the hardware rounds to the value whose least significant bit is 0 (even). This prevents statistical upward or downward drift during repeated calculations.

What are the maximum and minimum representable values in 32-bit float?

The maximum finite positive normalized value is (2 - 2^-23) × 2^127 ≈ 3.4028235 × 10^38 (hex 0x7F7FFFFF). The smallest positive normalized value is 2^-126 ≈ 1.17549435 × 10^-38 (hex 0x00800000). The smallest positive subnormal value is 2^-149 ≈ 1.4012985 × 10^-45 (hex 0x00000001).

How do I convert hexadecimal back to decimal floating-point by hand?

Convert each hex digit to 4 binary bits. Bit 31 is the sign bit S (0 for positive, 1 for negative). Bits 30 to 23 form the 8-bit biased exponent e; subtract 127 to find the unbiased exponent E = e - 127. Bits 22 to 0 form the 23-bit mantissa f. If e is between 1 and 254, compute Value = (-1)^S × (1 + f) × 2^E, summing the powers 2^-1, 2^-2, etc. for each 1 bit in the mantissa.

Have a suggestion for IEEE 754 Converter?Share your feedback ↗