1. Home
  2. Developer tools
  3. Binary to Hex

Binary to Hex

Paste a bit string and read it as hexadecimal. Because 16 is 2 to the power 4, every group of four bits is exactly one hex digit, and the working shows that grouping.

Free, no sign-up. Runs in your browser: nothing is uploaded.

How to use Binary to Hex

  1. Paste binary numbers, one per line.
  2. Read the hex value and the nibble-by-nibble table.
  3. Choose upper or lower case and an optional 0x prefix.

Features

  • Shows each group of four bits next to its hex digit
  • Pads with zeros on the left for integers and on the right for fractions
  • Upper or lower case output with an optional 0x prefix
  • No length limit on the bit string
  • Accepts spaces between bytes
  • Lists the decimal and octal values too

Supported formats

Input

  • Binary numbers
  • Typed or pasted numbers

You get

  • Hexadecimal
  • Nibble table

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the Binary to Hex is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • Numbers are read in the base named by the tool, so a digit outside that base is reported instead of guessed.
  • Bits are read as an unsigned number; a leading 1 does not mean a negative value.

Guide

Shortening binary to hexadecimal with groups of four bits

Sixteen is two to the fourth power, so one hexadecimal digit stands for exactly four bits. That tidy relationship is the reason hex appears in memory dumps, colour codes, hash values and debugger output: it is binary made short enough to read without losing the bit boundaries. This converter does the grouping and shows it.

The grouping rule

Split the bit string into groups of four, starting at the binary point and working outward. If the leftmost group is short, add zeros in front of it. If the last group after the point is short, add zeros after it. Each group of four is then a number from 0 to 15, which is written as 0–9 or A–F. The string 101101 becomes 0010 1101, which is 2D.

What the working shows

With the working switched on, the page prints the bits in their groups, an arrow, and the digit for each. Seeing the zeros that were added is useful, because it explains why the hex answer can look longer than you expect from the number of bits. The panel underneath lists the same value in octal, decimal and base 36, so you can cross-check against whichever base your exercise or document uses.

Options

Choose upper-case or lower-case letters to match the style of your code base. The prefix switch adds 0x for use in source code, and digit grouping inserts spaces in long results. Because spaces, underscores and a 0b prefix in the input are ignored, you can paste a dump with a space between each byte and read the whole thing as a single number.

Edge cases

An odd number of bits is common: a 7-bit ASCII code such as 1000001 is padded to 0100 0001 and becomes 41. A single leading zero group disappears from the result, so 00001111 gives F and not 0F. Pad the answer yourself if a format needs two digits per byte. Fractions are grouped from the point to the right, so 0.1 is padded to 0.1000 and gives 0.8.

Negative numbers keep their minus sign. They are not converted to a complement, so −1 is shown as −1 and not as FF.

A worked example

The Sample button loads 11010110.101. The integer bits split into 1101 and 0110, which are D and 6. The fraction bits 101 are padded on the right to 1010, which is A. The answer is D6.A, and in decimal the same number is 214.625. For a quick sanity check, D is 13 and 13 × 16 + 6 is 214; the .A is 10/16, which is 0.625.

Limits

The page converts values, not formats. It does not know whether your bits are a colour, a floating-point number or a network address, and it adds no padding to reach a register width. For floating-point layouts use the IEEE 754 converter, and for byte order problems use the endian converter. Very long inputs work, but the working lines grow with them, so turn the working off if you only need the answer.

Checked against the current version of the Binary to Hex on .

Frequently asked questions

Why do programmers prefer hex to long strings of bits?

Hex is four times shorter and still lines up with the bits. A mask such as 1111111100000000 is hard to compare by eye, while FF00 is not, and each digit can be checked against a table of sixteen patterns.

Does padding with zeros change the number?

Not when the zeros go on the outer side. Extra zeros on the left of the integer part or on the right of the fraction add nothing, which is why 10110 can be written as 0001 0110 and read as 16 in hex.

What if my bit count is not a multiple of four?

Pad the left side with zeros: 10110 becomes 0001 0110, which is 0x16. Leading zeros do not change the value.

Is a space-separated byte dump accepted?

Yes. Spaces and underscores are ignored, so 01001000 01101001 is read as one 16-bit number, 0x4869.

Keep working with the result

openWorkstand also includes a free workspace with documents, spreadsheets, tasks, projects and a calendar that save to a folder on your computer.