About the Binary to Hex Converter
Long binary strings are hard to read and easy to mistype, which is why programmers write them in hexadecimal, one hex digit for every four bits. This binary to hex converter groups your bits into fours from the right and converts each group: 11010110 becomes D6. It works exactly on numbers of any length and shows every group, so the method is clear.
No arithmetic on the whole number is needed: because 16 = 2^4, each hex digit corresponds to exactly four bits, so the converter splits the bits into groups of four from the right and replaces each group with a hex digit. The groups are shown in the working section. Examples: 1010 in binary is A in hexadecimal; 11111111 in binary is FF in hexadecimal; 110101111010 in binary is D7A in hexadecimal.
Long binary strings are hard to read and easy to mistype, so programmers and engineers convert them to hex, which is four times shorter. Network engineers do it with MAC addresses and packet dumps, embedded developers with register bit masks, and students when checking digital-logic exercises. The conversion is purely mechanical because every 4 bits map to exactly one hex digit.
Other bases are covered by the number base converter, which converts between any bases from 2 to 36. For arithmetic in these bases, use the binary calculator or the hex calculator; to turn text into its binary character codes, use text to binary.
How to use the Binary to Hex Converter
- Enter the binary numberType or paste the number. Digits 0 and 1. Spaces and underscores are ignored; a 0b prefix is fine.
- Read the hexadecimal resultThe hexadecimal value appears instantly, along with the octal and decimal equivalents.
- Follow the workingOpen the step-by-step section to see how the conversion was done, digit by digit or division by division.
- Copy or shareCopy all results with one click, or copy a link that reopens the converter with the same number.
Binary to Hex Converter features
- Exact conversion of numbers of any length using BigInt arithmetic
- Step-by-step working for homework and exam practice
- Octal and Decimal results shown alongside
- Negative numbers with 8- to 128-bit two's complement forms
- Optional digit grouping (4 bits, 2 hex digits or thousands) for easy reading
- Accepts prefixes such as 0x, 0b and 0o and ignores spaces and underscores
- Runs in your browser with nothing sent to a server
Common uses
- Checking computer science and digital electronics homework
- Reading values from datasheets, debuggers and log files
- Working out color codes, permissions and bit masks
- Converting values for programming and scripting
- Learning how positional number systems work
Binary to hex in practice: register values, grouping from the right, the sixteen patterns, seven-segment displays and fixed widths
Binary is how hardware thinks; hexadecimal is how people write it down without losing their place. Converting between them is a mechanical skill that pays off in digital electronics labs, networking and low-level programming. This guide converts register values, explains why grouping must start from the right, lists the sixteen patterns worth memorising and works through the classic seven-segment display example.
A worked example: register values
A digital electronics exercise gives the 8-bit value 1011 0110. Each group of four converts directly: 1011 is B and 0110 is 6, so the value is B6. A 16-bit value such as 0001 1111 1010 0011 becomes 1FA3 in the same way, four groups giving four hex digits. No arithmetic on the whole number is required, which is why engineers find hex so convenient.
Group from the right
When the number of bits is not a multiple of four, add zeros on the left before grouping. The value 101101 becomes 0010 1101, which is 2D. Grouping from the left instead, as 1011 01, produces the wrong answer. Starting at the right-hand end, where the smallest place values are, always gives the correct groups.
The sixteen patterns
Memorising the sixteen four-bit patterns makes conversions instant. A few anchors help: 0000 is 0, 0101 is 5, 1000 is 8, 1010 is A, 1100 is C and 1111 is F. The others are a step away from these. With the patterns memorised, converting a byte takes less than a second.
Seven-segment displays
A seven-segment display lights segments labelled a to g to form digits. If segment a is bit 0 and g is bit 6, showing the digit 0 lights segments a to f, the pattern 0111111, which is 3F in hex. Electronics students build tables of these patterns for every digit, and writing them in hex keeps the table compact and easy to enter into a microcontroller program.
Fixed widths
A byte is always two hex digits, a 16-bit value four and a 32-bit value eight. Keeping leading zeros, so 5 is written 05 in a byte table, preserves alignment and makes it clear how wide each value is. Dropping them makes columns of values hard to compare.
Network and hardware notation
MAC addresses are written as six pairs of hex digits, and IPv6 addresses as eight groups of up to four hex digits, each standing for 16 bits. Converting a group to binary, or back, shows which bits differ between two addresses, which helps when working with masks and address ranges.
Comparing dumps
When comparing two memory or file dumps, differences are far easier to spot in hex than in long strings of ones and zeros. Once a differing byte is found, converting just that byte back to binary shows exactly which bits changed, combining the readability of hex with the detail of binary.
Checking lab results
In digital logic labs, write measured outputs as bits, convert to hex and compare with the expected table. A single wrong hex digit pinpoints the group of four outputs containing the error, narrowing down which gate or connection to check first.
Bits that carry meaning
In many formats, individual bits act as switches, so a byte such as B6 really holds eight separate yes-or-no values. Converting to hex for writing and back to binary for interpretation is the everyday rhythm of reading flags, permissions and status registers in documentation and debuggers.
Common mistakes
- Grouping bits from the left instead of the right.
- Dropping leading zeros in fixed-width tables.
- Confusing B (1011) with D (1101).
- Converting whole numbers through decimal when grouping is quicker.
Related tools
To expand hex back into bits, use Hex to Binary Converter. For arithmetic on binary values, try Binary Calculator, and to start from decimal numbers, Decimal to Binary Converter.
Writing binary in code
Many programming languages accept binary values directly with a 0b prefix, such as 0b10110110, and JavaScript, Python and Java also allow underscores as digit separators, so the same value can be written 0b1011_0110. Grouping by four in code mirrors the hex digits and makes bit patterns much easier to read and review.
Extracting part of a byte
To read only the upper four bits of a byte, combine it with the mask F0, which is 1111 0000, then shift the result four places to the right. For B6, that leaves B. Seeing the value and the mask in binary makes it clear why the mask keeps some bits and clears others.
Counting set bits
Counting the ones in a binary value tells you how many flags are switched on. The byte B6, 1011 0110, has five bits set. Programmers call this the population count, and many processors provide a single instruction for it, used in tasks from permission checks to error-correcting codes.
Privacy
Conversions run in your browser. Nothing you enter is sent anywhere or stored.
Frequently asked questions
Why do you group binary digits in fours for hex?
Because 16 is 2 to the power of 4, every hex digit represents exactly four bits: 0000 is 0, 1010 is A and 1111 is F. Grouping from the right and replacing each group with its hex digit converts any binary number without doing arithmetic on the whole value.
What is the largest number this converter can handle?
It accepts up to 400 digits, far beyond the 64-bit limit of 18446744073709551615 (2^64 − 1). The calculation uses arbitrary-precision integers, so even very long numbers convert exactly without rounding.
Can I convert negative numbers?
Yes. Put a minus sign in front and the result keeps the sign, for example -1010 in binary is -A in hexadecimal. For binary work, the details section also shows the two's complement form that computers use to store negative integers.
Does it convert fractions or decimal points?
No. The converter works with whole numbers, which is what bases are used for in computing. Fractional values such as 0.1 often have infinitely repeating forms in binary, so they need a separate floating-point tool.
Why are the digits grouped?
Grouping makes long numbers easier to read and check: binary is split into blocks of 4 bits (one hex digit each), hex into pairs (one byte each) and decimal into thousands. Untick the grouping option to get one continuous string for copying into code.
Are hex letters case-sensitive?
No. The letters A to F and a to f mean the same values, 10 to 15, so 1f4, 1F4 and 0x1F4 are all read as 500. The converter accepts either case and always shows hex results in capitals, which is the most common convention in documentation.