Binary to Hexadecimal Converter
Binary and hexadecimal are the same numbers in two typefaces — every hex digit is exactly four bits. Enter binary for hex, or hex for binary, and this binary to hexadecimal converter does the nibble-by-nibble translation both ways.
The Nibble: Why Four Bits Make a Digit
Hexadecimal is base 16, and 16 is 2⁴ — which means one hex digit carries exactly the information of four binary digits, no more, no less, with nothing left over. That exact fit is the entire story: where decimal conversion demands division (10 is not a power of 2, so bits and digits never align), binary-to-hex is a regrouping — take the bits four at a time from the right, name each group (0000 = 0 … 1111 = F), and read the names in order. The groups are called nibbles (half a byte, in the field's enduring pun), and a byte is always exactly two hex digits, a 16-bit word four, a 64-bit address sixteen. This is why hex conquered computing's display layer: a memory dump in binary is an unreadable swamp, the same dump in hex is a document — each pair of digits a byte, each byte a character or a small number, patterns visible at a glance. The converter performs the regrouping mechanically and prints the decimal alongside as a bridge, but the nibble table in its note is the real instrument: sixteen entries, learnable in an afternoon, fluent for a career.
Worked Example: 10101111 Becomes AF
The default splits as 1010 | 1111: the first nibble is A (eight and two — 10 in decimal), the second is F (fifteen, all four bits set) — 10101111 = 0xAF, decimal 175 as the answer line confirms (10 × 16 + 15). The neighbours teach the table's ends: 11111111 is FF (255, the full byte, a number this hub's colour pages meet constantly), 00000000 is 00, and 10000000 is 80 — a single bit showing as a single 8, the pattern by which flags and masks are read. A longer specimen shows the scaling: 1101111010101101 groups as 1101 | 1110 | 1010 | 1101 = DEAD — hex's small alphabet of letters gives it a vocabulary of famous words (DEAD, BEEF, CAFE, FACE, FEED) that programmers plant in memory as canaries and signatures, a folklore the decimal system cannot match and a genuine debugging tool: when DEADBEEF appears in a dump, something put it there on purpose.
Where the Conversion Is Daily Bread
The crossings happen wherever humans read what machines store. Colour codes are hex bytes in a trench coat — #F43676 is three bytes, F4, 36, 76, each a channel's intensity as two nibbles — and this site's colour converter and the hex specialist live on the same arithmetic. Memory and debugging: addresses, pointers and register dumps are hex because their binary structure (page boundaries at 0x1000, flags in single bits) must stay visible, and bit masking is nibble reading by another name. Networking: MAC addresses are six hex bytes; IPv6 addresses are eight groups of four hex digits — the regrouping at internet scale. Low-level file formats: magic numbers announce themselves in hex (a PNG begins 89 50 4E 47 — the second byte onward spells PNG in ASCII, another nibble-world signature). In every case the professional's fluency is the same: bits grouped by four, read as digits, never converted through decimal unless a human quantity (a count, a size) is genuinely wanted — decimal is the tourist in this country, hex is the native.
Reading Masks: The Skill the Table Unlocks
The conversion's payoff skill is reading bitmasks at sight. A mask of 0x0F says "the low nibble"; 0xF0, "the high nibble"; 0xFF00FF00 in a 32-bit word selects alternating bytes. Because each hex digit is a nibble, a digit of F means "all four of these bits pass", 0 means "none do", and the interesting digits — 8, 4, 2, 1 and their sums — are single bits and pairs, so a permissions value like 0xA5 (1010 0101) can be read bit by bit straight off the hex: bits set at both ends, a gap, a pair. Programmers who seem to "just see" what a hex constant does are doing exactly this page's conversion, internalised — nibbles to digits and back without the decimal detour. The exercise that builds it is the reverse direction of this converter: take hex, expand to binary, read the bit pattern; take binary, group, name. Twenty minutes of it, once, is a permanent upgrade to anyone who reads code, captures packets or debugs hardware.
Hex Dumps: Reading the Grid Without Fear
The conversion's natural habitat is the hex dump — the grid in which files and memory are inspected raw — and a paragraph of orientation turns it from wallpaper into text. A dump prints each byte as two hex digits (this page's conversion, frozen), grouped in rows of sixteen, with the row's starting address (also hex) at the left and an ASCII gutter at the right where printable bytes show as characters. Reading one is nibble fluency at work: file signatures announce themselves in the first bytes (the PNG's 89 50 4E 47), text strings appear as runs of 20–7E values (the printable ASCII range, where 41 is A and 61 is a — the case bit visible as a single hex digit's difference of 2), and long runs of 00 or FF mark padding and erased space respectively. Nobody memorises the whole ASCII table; the working reader knows the landmarks — 00, 20 (space), 30 (zero), 41, 61, 7F, FF — and converts the rest with exactly the regrouping this converter performs. Twenty honest minutes with a dump of a known file teaches more about what files are than a chapter of description.
Related Tools
More from the Conversion Calculators hub: the Decimal to Hexadecimal Converter — the harder crossing, with real division in it — the Binary Calculator for arithmetic in base 2, and the Color Converter, where hex bytes become colours.
Frequently Asked Questions
How do you convert binary to hex by hand?
Group the bits in fours from the right (padding the leftmost group with zeros if needed), then replace each group by its table value: 1010 is A, 0101 is 5, 1111 is F. The whole skill is the sixteen-entry nibble table, and it repays memorising because the conversion has no arithmetic to check — a grouping either matches the table or it does not. For decimal, by contrast, there is no shortcut of this kind, which is the entire reason hex exists in computing.
What is 11111111 in hex?
FF — two nibbles of 1111, each worth F (15). As a byte it is 255 in decimal, the maximum an unsigned byte holds, which is why FF saturates this hub's pages: full-intensity colour channels (#FF0000 is full red), broadcast addresses, and erased flash memory (which reads as all FF) all wear it. Its partner 00 is the empty byte; the byte's whole world runs between the two, two nibbles at a time.
Why do programmers write 0x before hex numbers?
To declare the base — because "10" is two in binary, ten in decimal and sixteen in hex, and a bare number in code must not be ambiguous. The 0x prefix (C's convention, now nearly universal) marks hexadecimal; 0b marks binary in languages that support it. This converter prints its hex with the prefix for the same reason your code does: the digits A–F usually give the base away, but a digits-only hex number like 1010 — which in hex is decimal 4112, not one thousand and ten — contains nothing to betray its base, and the prefix is its passport.
Is hex case-sensitive — is AF the same as af?
The same number, yes: hex digits A–F may be written upper or lower case (styles vary by language and house — C code often lowercase, documentation often uppercase) and every parser accepts both. This converter normalises input to uppercase for display. The one caution is human, not technical: in handwriting and quick notes, lowercase a and 9, or f and t, can blur — print hex in capitals when it will be read off paper.
How do you convert hex back to binary in your head?
Expand each digit into its four bits, left to right — the nibble table read backwards. 0xA5 is A then 5: 1010 then 0101, giving 10100101. Keep the leading zeros inside each nibble (5 is 0101, not 101) or the groups collapse into nonsense — the commonest beginner error, and the reason the converter's reverse output preserves each digit's full four bits before trimming the whole number's front. With the landmarks memorised (8, 4, 2, 1 are the single bits; F and 0 the full and empty nibbles; 5 and A the alternating patterns), most digits expand without the table at all, at reading speed, in either direction.
How many hex digits does a 64-bit number need?
Sixteen — 64 bits ÷ 4 bits per digit — so a full memory address like 0x00007FFF5FBFF8C0 is sixteen nibbles, eight bytes. The leading zeros are meaningful in that context (they show the width), which is why dumps print them while calculators (this one included) usually trim them. Widths in the family are all multiples of the nibble: 8-bit bytes take 2 digits, 16-bit words 4, 32-bit words 8 — a regularity that makes hex lengths instantly legible about the size of the thing described.