Skip to content
AESTECHNO
AESTECHNO
Contact
HEX · DEC · BIN · IEEE 754

Hex to Decimal Converter: Binary, Two's Complement and IEEE 754

To convert hex to decimal, each digit is worth sixteen times the next: 0x1F = 1 × 16 + 15 = 31. The converter reads hex, decimal, binary, octal, text or a real number and shows it in 8 to 64 bits: unsigned, signed two's complement, big- and little-endian bytes, Q format and IEEE 754 floats with the exact stored value. The default 0x40490FDB is 1078530011, which is π in binary32 (3.1415927).

Inputs

Prefixes 0x, 0b, 0o and an h suffix are recognised; _ and spaces are ignored. For a real number, pick "Float".

Integer

Sets the accepted input range and the Q format. Both readings are always shown.

16-bit float

Q15 in 16 signed bits: n = 15. Leave blank if unused.

High to low bit, for example 11:4 or 7.

The word bit by bit The bits of the converted word, most significant first, grouped by four from the least significant bit, with the sign bit, the IEEE 754 sign, exponent and fraction fields, or the fixed-point integer and fraction parts highlighted. 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 1 1 1 1 1 1 0 1 1 0 1 1 0x40490FDB = 1078530011 unsigned 1078530011signed 10785300110o10022207733
Result

1078530011

Breakdown

0x40490FDB in 32 bits, unsigned

Hexadecimal 0x40490FDB
Unsigned decimal 1078530011
Signed (two's compl.) 1078530011
Binary 0100 0000 0100 1001 0000 1111 1101 1011
Octal 0o10022207733
Sign-extended to 64 bits 0x0000000040490FDB
Bytes, big-endian 40 49 0F DB
Bytes, little-endian DB 0F 49 40
C array, little-endian { 0xDB, 0x0F, 0x49, 0x40 }
Byte-swapped 0xDB0F4940
Bit-reversed 0xDBF09202
Set bits · parity 14 · even
Top set bit · trailing 0s 30 · 0
Gray: encoded · decoded 0x606D8836 · 0x7F8E0A92
ASCII characters @I··
binary32: value 3.1415927
binary32: s · exp · fraction 0 · 10000000 · 10010010000111111011011
binary32: exponent · class 128 − 127 = 1 · normal
binary32: exact value 3.1415927410125732421875
binary32: ulp 2^-22 = 2.38419e-7
binary32: next down · up 3.1415925 (0x40490FDA) · 3.141593 (0x40490FDC)

You receive the result with its direct link. Our design house gets a copy and can react to it, simply reply if you want an engineer's eye on it.

Integers are exact at every width up to 64 bits (BigInt). Floats round to nearest, ties to even, from the exact decimal you type, so binary16 and bfloat16 never double-round through binary64. The exact stored value is the dyadic rational the bits encode. Byte order applies to whole bytes; a 12-bit word is padded on the left.

TOOL // HEX · BINARY · IEEE 754

Registers, frames and number formats are settled between hardware and firmware. We design both, from sensor drivers to radio protocols. Let's talk about your project in a free 30-minute audit.

IEEE 754 formats and bfloat16

Exponent bits set the range, fraction bits the precision. bfloat16 spans the same range as binary32 with a little over two decimal digits, enough for neural-network weights; binary16 is more precise but tops out at 65504.

π in IEEE 754 binary32 The 32 bits of 0x40490FDB, the binary32 encoding of pi: sign bit 0, exponent 10000000, that is 128 minus the bias 127, so 2 to the power 1, and a 23-bit fraction. Value: minus 1 to the sign, times 1 point fraction, times 2 to the exponent minus 127. 0x40490FDB 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 1 1 1 1 1 1 0 1 1 0 1 1 31 0 S exponent (8) fraction (23) exponent 128 − bias 127 = 1 1.5707964 × 2^1 = 3.1415927 (−1)^s × 1.f × 2^(e − 127)
IEEE 754 binary32: π = 0x40490FDB
Binary floating-point formats
FormatBits (sign · exponent · fraction)BiasMax finiteMin normalDecimal digits
binary16 (half)16 (1 · 5 · 10)15655046.1035e-53.31
bfloat1616 (1 · 8 · 7)1273.3895e381.1755e-382.41
binary32 (float)32 (1 · 8 · 23)1273.4028e381.1755e-387.22
binary64 (double)64 (1 · 11 · 52)10231.7977e3082.2251e-30815.95

Integer range by width

An unsigned w-bit integer runs from 0 to 2^w − 1; in two's complement, from −2^(w−1) to 2^(w−1) − 1. The 12 and 24-bit widths are those of common analog-to-digital converters.

Integer ranges
BitsSigned minSigned maxUnsigned max
8−128127255
12−204820474095
16−327683276765535
24−8388608838860716777215
32−214748364821474836474294967295
64−9223372036854775808922337203685477580718446744073709551615

Example encodings

The same values in the four formats. At 16 bits, 0.1 and π keep only three or four significant digits.

Hex encodings (round to nearest, ties to even)
Valuebinary16bfloat16binary32binary64
10x3C000x3F800x3F8000000x3FF0000000000000
0.10x2E660x3DCD0x3DCCCCCD0x3FB999999999999A
−20xC0000xC0000xC00000000xC000000000000000
π0x42480x40490x40490FDB0x400921FB54442D18
Frequently asked questions

FAQ

How do you convert hex to decimal?
Multiply each digit by the power of 16 of its position, starting from the right: 0x2A = 2 × 16 + 10 = 42, and 0xFF = 15 × 16 + 15 = 255. Letters A to F stand for 10 to 15. One hex digit is exactly 4 bits, which is why hex reads straight into binary: 0x2A = 0010 1010. The converter works at any width up to 64 bits with no loss, using BigInt integers.
How does two's complement work?
In w bits, a pattern whose top bit is 1 stands for its unsigned value minus 2^w. In 8 bits, 0xFF is −1 and 0x80 is −128; the range runs from −128 to 127. To negate x, invert every bit and add 1. According to Wikipedia it is the most common way computers represent signed integers, and the C23 standard requires it.
How do I read a signed 24-bit ADC value?
Pick 24 bits and Signed: 0xFFFFFE reads −2, 0x800000 reads −8388608. To store the reading in an int32_t, sign-extend it by copying bit 23 into bits 24 to 31, so 0xFFFFFE becomes 0xFFFFFFFE. Forgetting it gives 16777214 instead of −2, a classic trap with delta-sigma ADCs such as load-cell front ends.
How is an IEEE 754 float encoded?
A binary32 holds 1 sign bit, 8 exponent bits biased by 127 and 23 fraction bits, with an implicit leading 1 for normal numbers. 1.0 is 0x3F800000 and 0.1 is 0x3DCCCCCD. IEEE 754-2019 also defines binary16 and binary64; bfloat16, used in machine learning, keeps binary32's 8-bit exponent with only 7 fraction bits.
Why is 0.1 not exact in floating point?
0.1 has no finite binary expansion, just as 1/3 has none in decimal. The nearest binary64 value is exactly 0.1000000000000000055511151231257827021181583404541015625; in binary32 it is 0.100000001490116119384765625, an error of 1.49 × 10⁻⁹. The converter shows this exact stored value, the rounding error and the spacing to the next float (ulp).
What does Q15 mean?
A fixed-point Qm.n number is an integer divided by 2^n. Q15 is 16 signed bits with 15 fractional bits: it spans −1 to 0.99997 in steps of 2⁻¹⁵, 0x4000 is 0.5 and 0x8000 is −1. According to Wikipedia, TI notation counts m without the sign bit (Q0.15) while ARM notation includes it (Q1.15). It is the format of DSP code and filters on microcontrollers without an FPU.
Go further

An electronics design house based in Montpellier, France, AESTECHNO brings 10+ years of design experience and a 100% success rate on CE/FCC certifications, across dozens of campaigns run over more than 10 years of practice. Encodings follow IEEE 754-2019, checked against Wikipedia's tables.