ToolNimba

๐Ÿ”ข Binary to Hex Converter

Shihab Mia By Shihab Mia ยท Updated 2026-07-27

Hexadecimal
F0
Decimal
240
Bit length
8 bits
Grouped into nibbles (4 bits = 1 hex digit)
Quick reference: 0 to 15
Binary Hex Decimal

This binary to hex converter turns any binary number (a string of 0s and 1s) into its exact hexadecimal and decimal equivalent, instantly and in the browser. Type a value like 11110000 and it shows the hex result F0, the decimal value 240, and how the bits group into nibbles to produce each hex digit. It handles binary numbers of any length using BigInt math internally, so long values stay exact instead of rounding.

What is the Binary to Hex Converter?

Binary is base 2, meaning every digit (a "bit") is either 0 or 1, and each position represents a power of 2. Hexadecimal is base 16, using the digits 0 to 9 and then A to F to represent 10 to 15 in a single character. The two bases are related in a convenient way: 16 is exactly 2 to the power of 4, so every single hex digit corresponds to exactly 4 binary bits, no more and no less. That is why converting binary to hex is really just a grouping exercise once you know the trick.

The fast method, and the one this tool uses conceptually, is to split the binary number into groups of 4 bits starting from the right (padding the leftmost group with zeros if needed), then convert each group of 4 bits into a single hex digit using the 0 to 15 mapping. For example, 11110000 splits into 1111 and 0000. The first nibble, 1111, is 15 in decimal, which is F in hex. The second nibble, 0000, is 0, which is just 0. Put together, the hex result is F0. This nibble method avoids doing the full binary-to-decimal-to-hex conversion by hand, which gets tedious for long numbers.

Under the hood, this converter still computes the exact decimal value too, because it is useful to see all three representations together. For binary numbers up to 53 bits long, JavaScript's built-in Number type keeps the conversion exact. Beyond that, standard floating-point numbers start to lose precision, so this tool switches to BigInt arithmetic automatically for anything longer than 53 bits, guaranteeing an exact result even for very long binary strings such as those used in cryptography, networking, or low-level programming.

The main limitation is input format, not math: the tool only accepts plain binary digits (0 and 1, spaces are stripped automatically). It does not accept a "0b" prefix, signed two's-complement notation, or fractional binary points (like 101.11). If you need to convert a signed integer or a binary fraction, treat the sign or fractional part separately before or after using this tool.

When to use it

  • Converting a binary value from a programming assignment or textbook into hex for a quick answer check.
  • Reading register values, memory dumps, or network packet data that are shown in binary but easier to work with in hex.
  • Working through digital electronics or computer science coursework on number base conversion.
  • Converting color, permission, or flag bitmasks between binary and hex representations.
  • Double-checking a manual binary-to-hex conversion before using the value in code or documentation.
  • Teaching or learning how nibbles map to hex digits with a live, visual example.

How to use the Binary to Hex Converter

  1. Type or paste a binary number into the input box (only 0 and 1 digits, spaces are ignored).
  2. The hexadecimal and decimal results update instantly as you type, no button press required.
  3. Check the nibble breakdown below the result to see exactly how each group of 4 bits became one hex digit.
  4. Use the Copy hex button to copy the hexadecimal result to your clipboard.
  5. Refer to the 0 to 15 quick reference table if you want to convert small groups by hand too.

Formula & method

Pad the binary string on the left with zeros until its length is a multiple of 4. Split it into groups of 4 bits (nibbles), starting from the right. Convert each nibble to decimal (0 to 15), then to its single hex digit (0 to 9, A to F). Concatenate the hex digits in order to get the final hexadecimal result. Equivalently: hex = parseInt(binary, 2).toString(16).toUpperCase(), using BigInt instead of Number for binary strings longer than 53 bits to avoid precision loss.
11110000 (binary)11110000F0each nibble to 1 digit

Worked examples

Convert the binary number 11110000 to hexadecimal.

  1. The binary string is already 8 bits long, a multiple of 4, so no padding is needed.
  2. Split into two nibbles: 1111 and 0000.
  3. Convert the first nibble: 1111 in binary is 8+4+2+1 = 15 in decimal, which is F in hex.
  4. Convert the second nibble: 0000 in binary is 0 in decimal, which is 0 in hex.
  5. Combine the hex digits in order: F0.

Result: 11110000 in binary = 240 in decimal = F0 in hexadecimal

Convert the longer binary number 1010111100001101 to hexadecimal.

  1. The string is 16 bits long, already a multiple of 4, so split directly into four nibbles: 1010, 1111, 0000, 1101.
  2. Convert 1010: 8+2 = 10 in decimal, which is A in hex.
  3. Convert 1111: 8+4+2+1 = 15 in decimal, which is F in hex.
  4. Convert 0000: 0 in decimal, which is 0 in hex.
  5. Convert 1101: 8+4+1 = 13 in decimal, which is D in hex.
  6. Combine the digits in order: A, F, 0, D, giving AF0D. Checking against the full decimal value confirms 1010111100001101 in binary equals 44813 in decimal, and 44813 in hex is indeed AF0D.

Result: 1010111100001101 in binary = 44813 in decimal = AF0D in hexadecimal

Binary, hexadecimal and decimal for 0 to 15 (one nibble)

Binary (4 bits)HexDecimal
000000
000111
001022
001133
010044
010155
011066
011177
100088
100199
1010A10
1011B11
1100C12
1101D13
1110E14
1111F15

Common full-byte binary to hex conversions

Binary (8 bits)HexDecimal
00000000000
000011110F15
11110000F0240
011111117F127
1000000080128
10101010AA170
010101015585
11111111FF255

Common mistakes to avoid

  • Forgetting to pad to a multiple of 4 bits. If a binary number is not a multiple of 4 bits long, such as 1011010 (7 bits), you must pad it with leading zeros to 01011010 (8 bits) before splitting into nibbles, otherwise the grouping and the resulting hex digits will be wrong.
  • Including a 0b prefix or spaces in the input. Some programming languages write binary as 0b1010. This tool expects plain digits only, so strip any 0b prefix first. Spaces used to visually separate nibbles, like 1010 1111, are stripped automatically and are safe to include.
  • Assuming Number can handle any length exactly. JavaScript and many calculators use 64-bit floating point numbers, which only represent integers exactly up to 2^53. A binary string longer than 53 bits converted with plain Number math can silently round to the wrong value. This tool switches to BigInt automatically past that point to stay exact.
  • Confusing hex letters with decimal digits. In hexadecimal, A through F represent the decimal values 10 through 15, not the letters themselves. Reading F0 as "eff zero" in decimal terms is a common beginner mistake. F0 in hex is 15*16 + 0 = 240 in decimal, not 50 or 70.

Glossary

Bit
A single binary digit, either 0 or 1. It is the smallest unit of digital information.
Nibble
A group of 4 bits, capable of representing values 0 to 15. One nibble always maps to exactly one hexadecimal digit.
Byte
A group of 8 bits, equal to two nibbles. A byte is represented by exactly two hexadecimal digits, for example FF for 8 ones.
Hexadecimal (hex)
A base-16 number system using the digits 0 to 9 and the letters A to F to represent values 10 to 15 in a single character.
Radix (base)
The number of unique digits a number system uses. Binary has radix 2, decimal has radix 10, and hexadecimal has radix 16.
BigInt
A JavaScript numeric type that represents whole numbers of arbitrary size exactly, used here for binary inputs longer than 53 bits.

Frequently asked questions

How do you convert binary to hex by hand?

Pad the binary number with leading zeros until its length is a multiple of 4, split it into groups of 4 bits (nibbles) from the right, convert each nibble to its 0 to 15 decimal value, then write that value as a single hex digit (0 to 9, or A to F for 10 to 15). Combine the hex digits in order for the final answer.

What is 11110000 in hex?

11110000 splits into the nibbles 1111 and 0000. 1111 is 15 in decimal, which is F in hex, and 0000 is 0. So 11110000 in binary equals F0 in hexadecimal, which is 240 in decimal.

Why does 1 hex digit always equal 4 binary bits?

Because 16, the base of hexadecimal, is exactly 2 to the power of 4. Four binary bits can represent 16 distinct values (0000 to 1111, or 0 to 15), which is exactly the range one hex digit covers, so the mapping is always one-to-one with no remainder.

Can this tool convert very long binary numbers accurately?

Yes. For binary numbers up to 53 bits, it uses standard exact integer math. Beyond 53 bits, it automatically switches to BigInt arithmetic, which keeps arbitrarily long binary numbers exact instead of rounding, unlike calculators that rely only on floating-point numbers.

Does this tool handle negative or signed binary numbers?

No, it treats the input as an unsigned (plain positive) binary value. If your binary number represents a signed integer using two's complement, convert the sign separately, since the tool only reads the digits 0 and 1 literally.

What is the difference between binary to hex and binary to decimal?

Binary to decimal converts a base-2 number into base-10 by summing the powers of 2 for each 1 bit. Binary to hex converts the same number into base-16 by grouping bits into nibbles. Both represent the same underlying value, hex is just a shorter, more compact way to write it, since one hex digit replaces four binary digits.