How to use this calculator
Type a binary number (digits made only of 0 and 1) into the field above, then click Calculate. The tool converts it to hexadecimal (base 16), shows the decimal (base 10) value as an intermediate check, splits the binary digits into 4-bit groups, and reports how many bits you entered. Spaces are ignored, so you can paste a value like 1101 0110 and it will still convert correctly.
The formula: why binary and hexadecimal line up so neatly
Binary is base 2 (digits 0-1) and hexadecimal is base 16 (digits 0-9 then A-F for 10-15). The key fact that makes conversion easy is that 16 = 2⁴. Because a hex digit's full range (0-15) is exactly covered by 4 binary bits (0000-1111), every hexadecimal digit corresponds to precisely one group of 4 binary digits, with no remainder and no rounding. That means you can convert without ever going through long division: split the binary number into 4-bit chunks counting from the right, pad the leftmost chunk with zeros if needed, and replace each chunk with its hex digit using the table below.
4-bit binary to hex lookup table
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. For example, take the byte 11010110: split into two nibbles, 1101 and 0110. From the table, 1101 = D and 0110 = 6, so the hexadecimal result is D6. You can verify this the long way through decimal: 11010110₂ = 128+64+16+4+2 = 214₁₀, and 214 = 13×16 + 6 = D6₁₆.
Worked examples
1010 (4 bits) → decimal 10 → hex A. 11111111 (one byte, all ones) → decimal 255 → hex FF, the maximum value a single byte can hold. 100000000 (9 bits) → decimal 256 → hex 100 — note it needs 3 hex digits because 256 is one more than FF (255). 1111111111111111 (16 bits) → decimal 65535 → hex FFFF, the maximum value of an unsigned 16-bit integer, a number that shows up constantly in networking (port numbers), color depth, and older data formats.
Where this conversion is actually used
Hexadecimal exists because raw binary is hard for people to read and write, while it maps perfectly onto how computers group bits into bytes (8 bits = 2 hex digits). You will see hex-encoded binary in: memory addresses and pointers (e.g. 0x7FFE1A2B), CSS/web colors (#FF5733 is three bytes: red=FF, green=57, blue=33), MAC addresses (3C:22:FB:A1:9B:2E, each pair a byte), file hashes (MD5, SHA-1/256 are displayed as hex strings), assembly-language and debugger output, and error codes in low-level programming. In every one of these cases, the underlying data is genuinely binary — hex is just a shorthand that is 4x more compact than writing out the 1s and 0s, and far easier to read than raw binary or convert than decimal, since it lines up on 4-bit boundaries.
Signed numbers and negative values
This calculator treats the input as an unsigned (non-negative) binary value, which is the standard convention for straightforward binary-to-hex conversion. If you are working with signed integers stored in two's complement (common in CPUs), the same bit pattern's hex representation is identical — what changes is only how you choose to interpret the hex/binary value afterward (e.g., an 8-bit value of 11111111 converts to hex FF either way; whether you read that as 255 unsigned or -1 in signed two's complement depends on the context you're working in, not on the conversion itself).
Common mistakes
The most frequent error is padding on the wrong side: when grouping into nibbles, always add leading zeros on the left (most significant end) of the binary number, never the right — padding on the right changes the value. For example, 101 (decimal 5) padded correctly is 0101 = hex 5; padded incorrectly on the right it becomes 1010 = hex A, a different number entirely. Another common mistake is forgetting that hex letters A-F are case-insensitive in meaning (a=A=10) but many programming languages expect a specific case, so check your target format. Finally, remember leading zeros in the hex output are often significant for fixed-width fields (a single byte is always written as two hex digits, e.g., 5 as "05" not "5").
FAQ
Why is hexadecimal used instead of just binary or decimal? Because 16 = 2⁴, each hex digit cleanly represents exactly 4 bits with no rounding, making conversion trivial and the notation roughly four times shorter than binary while staying easy to translate.
What is the largest value one hex digit can represent? F, which equals 15 in decimal and 1111 in binary — the largest 4-bit value.
How many hex digits does a byte need? Exactly 2, since a byte is 8 bits and 8 ÷ 4 = 2 nibbles. The range is 00 to FF (0 to 255 in decimal).
Does the order of digits matter? Yes — binary and hexadecimal are both positional number systems read left to right from most significant to least significant digit, just like decimal.
Can I convert a binary number with leading zeros, like 00001010? Yes; leading zeros don't change the value (it still equals decimal 10, hex A), though this calculator will report the bit-length you actually typed.
Is 0x always used before hex numbers? The "0x" prefix is a common programming convention (used in C, JavaScript, Python, etc.) to mark a literal as hexadecimal; it is not part of the numeric value itself.