Binary to Hex Converter

Convert Binary to Hex instantly in your browser.

0 characters

0 characters

Everything is converted in your browser. Nothing you paste is uploaded or stored.

Worked example

Each row shows a short sample written as Binary, and the same value converted to Hex.

Binary input Hex output
01001000 01101001 48 69
01010011 01000111 53 47
01110100 01101111 01101111 01101100 74 6F 6F 6C

In-depth guide

Binary to hex: group by four from the right

How to shorten a bit string into hexadecimal by hand, worked examples checked with the converter, and the byte-by-byte behaviour that makes 1010 0101 come out as 0A 05 rather than A5.

Last verified: Sources: MDN Number.prototype.toString Plain-text version of this guide

Key figures at a glance

Grouping rule
4 bits = 1 hex digit, counted from the right
Pad the leftmost group with zeros if it is short.
What the tool treats as one byte
Each space-separated group of up to 8 binary digits
A short group is padded on the left, so 1010 becomes 0A.
Output format
Two upper-case hex digits per byte, separated by spaces
Leading zeros are kept: 00001010 gives 0A.
Same conversion in JavaScript
parseInt("10100111", 2).toString(16) returns "a7"
The built-in method gives lower case and no leading zero.
Source: MDN Number.prototype.toString

Binary to hex by hand

Shown for 111110100 (500 in decimal), a length that does not fill whole bytes.

  1. Step 1: Count groups of four from the right

    111110100 splits as 1 | 1111 | 0100.

  2. Step 2: Pad the leftmost group with zeros

    1 becomes 0001, giving 0001 1111 0100.

  3. Step 3: Replace each group with its hex digit

    0001 is 1, 1111 is F and 0100 is 4, so the result is 1F4.

  4. Step 4: Use the tool for whole bytes

    The tool works byte by byte; for an 8-bit value such as 10100111 it returns A7.

Why four bits per hex digit

Binary strings get long quickly. Because 16 is 2 to the power 4, every block of four bits corresponds to exactly one hex digit, so you can shorten a bit string without any arithmetic. The only care needed is where to start counting: always from the right, because the rightmost bit is the least significant. Starting from the left gives the wrong answer whenever the length is not a multiple of four.

Worked examples

Binary Grouped in fours Hex
10100111 1010 0111 A7
11010110 1101 0110 D6
01111111 0111 1111 7F
10101010 1010 1010 AA
01000001 01000010 0100 0001, 0100 0010 41 42
1111000010101010 1111 0000 1010 1010 F0 AA
11111111 10001000 00000000 three bytes FF 88 00

All hex values above are the converter's own output. The last row has the shape of a colour code: with a # in front, FF8800 is a vivid orange in CSS.

How the converter reads your bits

The tool is byte-based. Separated groups are each one byte, so what it shows depends on how you spaced the digits.

You enter Result Why
10100111 A7 one byte
1010 0111 0A 07 two separate bytes, each padded to eight bits
1010 0A a short group is padded on the left
1111000010101010 F0 AA an unbroken run is cut every 8 digits
111110100 length error nine digits in one run do not divide into bytes

So the tool does not replace the manual method for odd lengths. If you want a single hex number such as 1F4 for the nine-bit value above, do the grouping by hand as in the steps and use the tool to confirm each byte.

Tip: When you paste a binary dump that someone has spaced into nibbles (groups of four), remove the spaces first, or the tool will turn every nibble into its own padded byte.

Common mistakes

  • Spacing nibbles and expecting one number. 1010 0101 gives 0A 05, not A5. Write 10100101 instead.
  • Grouping from the left. 1101101 becomes 6D when grouped from the right (0110 1101), not DA.
  • Forgetting the leading zero in the output. 00001010 becomes 0A, not A; the converter always shows two digits per byte.
  • Reading lower-case and upper-case as different. a7 and A7 are the same value; the tool shows upper case.

Frequently asked questions

Is my data sent anywhere?

No. The conversion runs entirely in your browser using JavaScript. Nothing you paste leaves your device, is logged, or is stored.

How should I separate values?

Spaces work, and so do commas, colons and semicolons. For binary, hex and octal you can also paste a single unbroken run of digits — it is split into bytes automatically.

Does it handle emoji and non-English text?

Yes. Text is treated as UTF-8, so accented characters, Chinese, Tamil and emoji all convert correctly. They simply take more than one byte each.

Why did I get an error?

The input contained a character that is not valid for the source format, a value above 255, or a run of digits that does not divide evenly into bytes. The message names the specific token so you can find it.

Sources

  1. MDN: Number.prototype.toString() — toString(16) gives lower-case hexadecimal digits with no padding.
  2. MDN: parseInt() — parseInt(string, 2) reads binary digits.

This guide explains published rules in plain language. It is not financial, legal or official advice — rules change, so confirm with the agency linked above before you commit.

Related converters