FP16 Converter
Convert decimal numbers to IEEE 754 FP16 binary16 representation or decode a 16-bit FP16 pattern back to its numeric value. View the sign bit, exponent field, fraction field and hexadecimal representation.
What Is FP16?
FP16 is a 16-bit floating-point format defined by IEEE 754 and commonly called binary16 or half precision. It represents floating-point numbers using fewer bits than the 32-bit single-precision format.
An FP16 value contains one sign bit, five exponent bits and ten explicitly stored fraction bits. This compact representation reduces storage and data-transfer requirements but also provides less numeric precision and a smaller range than larger floating-point formats.
FP16 Bit Layout
| Field | Bits | Purpose |
|---|---|---|
| Sign | 1 | Determines positive or negative sign |
| Exponent | 5 | Stores the biased exponent |
| Fraction | 10 | Stores the fractional significand bits |
| Total | 16 | Complete IEEE 754 binary16 value |
S | EEEEE | FFFFFFFFFF
1 sign bit
5 exponent bits
10 fraction bits
Decimal to FP16 Example
Consider the decimal value 1.5. Its normalized binary representation is 1.1 × 2⁰.
1.5
FP16:
0 01111 1000000000
Complete binary:
0011111000000000
Hex:
3E00
The sign bit is zero because the value is positive. The true exponent is zero, which is stored as 15 because binary16 uses an exponent bias of 15. The fraction represents the binary .1 portion.
FP16 Exponent Bias
For normal finite values, FP16 stores an exponent using a bias of 15. The actual exponent is therefore calculated by subtracting 15 from the stored exponent field.
Bias = 15
Actual exponent:
15 – 15 = 0
Exponent fields consisting entirely of zeros or entirely of ones have special meanings and are not interpreted using the normal-value rule.
Normal and Subnormal FP16 Values
Normal Values
For a normal value, the exponent field is neither all zeros nor all ones. The significand has an implicit leading 1.
Subnormal Values
When the exponent field is zero and the fraction is nonzero, the number is subnormal. Subnormal values allow FP16 to represent numbers closer to zero with reduced precision.
FP16 Special Values
| Exponent | Fraction | Meaning |
|---|---|---|
| 00000 | 0000000000 | Zero |
| 00000 | Nonzero | Subnormal number |
| 00001–11110 | Any | Normal finite number |
| 11111 | 0000000000 | Infinity |
| 11111 | Nonzero | NaN |
FP16 Numeric Range
The largest finite positive binary16 value is 65504. Values larger than the representable finite range may round to infinity when converted to FP16.
The smallest positive normal FP16 value is 2⁻¹⁴, approximately 0.00006103515625. Binary16 also supports smaller positive subnormal values down to 2⁻²⁴.
65504
Smallest positive normal:
0.00006103515625
Smallest positive subnormal:
0.000000059604644775390625
Why FP16 Is Useful
FP16 stores each floating-point value in only two bytes. That can reduce memory usage and memory bandwidth compared with 32-bit floating-point data.
Half precision is therefore useful in workloads where reduced precision is acceptable and compact numerical representation is valuable. It is commonly encountered in GPU computing, graphics, numerical workloads and machine-learning systems.
This calculator focuses strictly on the FP16 representation itself: converting numbers to binary16 and decoding binary16 bit patterns.
FP16 Rounding
Most ordinary decimal values cannot be represented exactly using only ten stored fraction bits. When this happens, the value must be rounded to the nearest representable FP16 number.
Therefore, converting a decimal value to FP16 and decoding it again can sometimes produce a slightly different decimal value. This is an expected consequence of finite floating-point precision rather than an error in the converter.
Important FP16 Notes
FP16 contains 1 sign bit, 5 exponent bits and 10 stored fraction bits.
The exponent bias for normal FP16 values is 15.
Decimal values may be rounded because FP16 has limited precision.
The maximum finite positive FP16 value is 65504.
Exponent 11111 represents infinity when the fraction is zero and NaN when the fraction is nonzero.
Exponent 00000 represents zero when the fraction is zero and a subnormal number when the fraction is nonzero.