Convert fractional binary numbers to hexadecimal
How to convert binary numbers with a radix point to hexadecimal, why grouping direction matters, how floating-point bit patterns differ, and where the output stays usable.
Converting a binary number that has a fractional part into hexadecimal is one of the few base conversions that is always exact. Because 16 is 2 to the fourth power, every group of four bits maps to exactly one hex digit. A finite binary fraction therefore becomes a finite hex fraction with no rounding. The method is short, but one detail causes most errors: which way you group the bits on each side of the point.
Is this conversion suitable for your purpose?
Use hexadecimal when you need a compact, exact representation of a binary value that people can read. Hex is about a quarter of the length of the binary string, and you can recover the original bits with no loss. That makes it useful for notes, debugging output, documentation of fixed-point values, and communication between people who already work in hex.
The main tradeoff is interpretation. A hex number with a point in it, such as B.A, is unambiguous to a reader who knows it is base 16. Many programs, parsers and readers will not assume that. Plain decimal is the better choice when the audience is not technical, when the value will be typed into a field that expects ordinary numbers, or when the magnitude matters more than the bit pattern. Keep the original binary when individual bit positions are the point of the exercise, such as flags or teaching material on binary place value.
What the conversion actually changes
This is a change of numeral base, not a visual or typographic transformation. The value stays the same. Only the digits used to write it change. Nothing is reversed, mirrored or restyled, and the output uses ordinary characters: the digits 0 to 9, the letters A to F, and a point.
The word 'direction' matters here in a specific sense. Bits are grouped outward from the radix point. The integer part is grouped right to left, starting at the point. The fractional part is grouped left to right, starting at the point. Any incomplete group is padded with zeros on the outer end. That means leading zeros on the left of the integer part and trailing zeros on the right of the fraction. Padding on the outer end never changes the value. Padding on the inner side does.
Step-by-step method
- 1. Split the binary number at the radix point.
- 2. Integer part: starting at the point and moving left, split the bits into groups of four. Pad the leftmost group with leading zeros if needed.
- 3. Fractional part: starting at the point and moving right, split the bits into groups of four. Pad the rightmost group with trailing zeros if needed.
- 4. Replace each four-bit group with its hex digit.
- 5. Write the integer digits, then the point, then the fractional digits.
| Binary | Hex |
| 0000 | 0 |
| 0001 | 1 |
| 0010 | 2 |
| 0011 | 3 |
| 0100 | 4 |
| 0101 | 5 |
| 0110 | 6 |
| 0111 | 7 |
| 1000 | 8 |
| 1001 | 9 |
| 1010 | A |
| 1011 | B |
| 1100 | C |
| 1101 | D |
| 1110 | E |
| 1111 | F |
Worked examples
Example 1: 1011.101
Integer part: 1011 -> B
Fractional part: .101 -> .1010 -> .A (pad on the right)
Result: B.A
Check: 1011.101 (binary) = 8 + 2 + 1 + 0.5 + 0.125 = 11.625
B.A (hex) = 11 + 10/16 = 11.625
Example 2: 110101.0111011
Integer part: 110101 -> 0011 0101 -> 35 (pad on the left)
Fractional part: .0111011 -> .0111 0110 -> .76 (pad on the right)
Result: 35.76
Check: integer 110101 = 53, and 0x35 = 3*16 + 5 = 53
fraction .0111011 = 0.4609375
fraction .76 (hex) = 7/16 + 6/256 = 0.4609375
The most common mistake is padding the fraction on the wrong side. If .101 is padded to .0101 instead of .1010, the result is .5 in hex. That equals 0.3125, not the correct 0.625. Leading zeros in a fraction are significant. Trailing zeros are not.
If the binary fraction repeats forever, the hex fraction repeats too, and any written version is a truncation. Say where you cut it off and whether you rounded. The conversion itself does not add error. Any loss comes from truncating a value that was already infinite.
When 'floating point' means something different
People who search for floating-point binary to hexadecimal usually mean one of two things. The answer differs a lot between them.
The first meaning is a binary number with a point, as in the examples above. The method is the grouping technique already described.
The second meaning is the stored bit pattern of an IEEE 754 floating-point value written in hex. In this case you do not group around the radix point. You first encode the number as sign, exponent and significand. You then convert the full 32-bit or 64-bit pattern to hex in four-bit groups. The result looks like an integer and has no point. For example, the single-precision encoding of 1.0 is 3F800000.
11.625 as an IEEE 754 single-precision bit pattern
Binary: 1011.101 = 1.011101 x 2^3
Sign: 0
Exponent: 3 + 127 = 130 = 10000010
Significand: 01110100000000000000000 (leading 1 is implicit)
Bits: 0100 0001 0011 1010 0000 0000 0000 0000
Hex: 413A0000
A third notation sits between the two. Hexadecimal floating-point literals, as defined in C since C99, write a hex significand with a binary exponent marked by p. The same value, 11.625, can be written as 0x1.74p3. That means 1.453125 multiplied by 2 to the third power. In C this form requires the p exponent, so the bare form B.A is not a valid C literal.
| Notation | Example for 11.625 | Typical use |
| Plain hex fraction | B.A | Hand calculation, teaching, notes |
| Hex float literal | 0x1.74p3 | Source code in languages that support it |
| IEEE 754 single-precision bit pattern | 413A0000 | Memory dumps, protocol and file-format inspection |
Will the result stay readable after copying or sharing?
The output contains only basic Latin letters, digits and a period. Unlike styled Unicode text, it does not depend on special fonts, and it should copy and paste as the same characters. The risks are about meaning, not rendering.
- Base ambiguity: B.A or 35.76 gives no sign that it is hexadecimal. 35.76 in particular will be read as decimal. Label the base in words, for example '35.76 (hexadecimal)', or use a convention your audience already recognizes.
- Prefix conventions: 0x marks hex in many programming contexts. Other conventions exist, such as a trailing h or a subscript 16. None of them is universal.
- Unicode subscripts: writing the base as a subscript character such as ₁₆ is a character substitution, not formatting. It may display, copy, search or read aloud differently from the plain digits 16. Plain text such as 'base 16' is the safer equivalent.
- Parsers and spreadsheets: many tools that accept hex integers do not accept a hex fraction with a point. Some languages provide dedicated functions or literal forms for hex floats, often with a required exponent. Check the documentation of the specific tool before you rely on it.
- Decimal separators: in locales that use a comma as the decimal separator, a period inside a hex value can be misread. Converting it to a comma can break parsing.
- Letter case: A to F and a to f mean the same thing in hex. Pick one case and use it consistently so readers do not mistake a letter for part of a word or identifier.
Accessibility is untested here. No screen reader or assistive-technology testing was supplied for this article, so no claim is made about how a given screen reader announces a value like B.A or 0x1.74p3. Some readers may announce letters individually, and some may treat the point as punctuation. If the audience includes people who use assistive technology, give the value in words or provide the decimal equivalent next to it.
Gaps in the evidence
The arithmetic examples above were checked by converting both sides back to decimal. No particular online converter, spreadsheet, programming environment or screen reader was tested. Some questions are therefore unanswered here: how a specific tool handles repeating fractions, rounding, letter case, or input with a point, and what such a tool does with the data you enter. Verify those against the tool's own documentation or a small test with known values, such as 1011.101 converting to B.A.
Recommendation
Convert fractional binary to hexadecimal when you want a shorter, exact and reversible form of the same value for a technical reader. Group outward from the point and pad only on the outer ends. Label the base in plain text. Before you move a value between systems, confirm whether you need a plain hex fraction, a hex float literal, or an IEEE 754 bit pattern. If the reader needs to know how large the number is rather than which bits it contains, give the decimal value, either instead of the hex or alongside it.