What Is a Binary Number? Binary to Hex, Explained

Bits, bytes, base 2 and base 16 in plain language: how to convert binary to decimal and hex by hand, and why computers work this way.

Technology 6 min read

Every photo, song and message on your phone is stored as a long string of 0s and 1s. That is binary, the number system computers are built on. It looks intimidating at first, but it follows the same logic as the numbers you already use every day.

In this guide you will learn what a binary number is, how to convert between binary and decimal step by step, what hexadecimal is, why programmers love it and how to turn binary into hex in seconds.

Convert binary to hex instantly Paste a binary number and get hex and decimal results in your browser. Nothing is sent or stored. Open the converter

Base 10 versus base 2

The decimal system (base 10) uses ten digits, 0 to 9. Each position in a number is worth ten times more than the one to its right: in 345, the 5 means five ones, the 4 means four tens and the 3 means three hundreds.

Binary (base 2) works the same way but uses only two digits, 0 and 1. Each position is worth two times the one to its right: 1, 2, 4, 8, 16, 32 and so on. Only the base changes, not the idea.

Bits and bytes

A bit is a single binary digit, either 0 or 1. It is the smallest piece of information a computer handles. A byte is a group of 8 bits.

With 8 bits you can write 256 different values (2 to the power of 8), from 00000000 (0) to 11111111 (255). That is why you see the number 255 so often: it is the largest value that fits in one byte.

How to convert binary to decimal

Write the place values under each bit, from right to left: 1, 2, 4, 8, 16... Then add up the place values where the bit is 1.

Example with 1011: from the left the bits are worth 8, 4, 2 and 1. The bits are 1, 0, 1, 1, so you add 8 + 0 + 2 + 1 = 11. Therefore 1011 in binary equals 11 in decimal.

Another example: 11111111 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255.

How to convert decimal to binary

Divide the number by 2 again and again, writing down each remainder, until the quotient is 0. Then read the remainders from the last to the first.

  1. Take 11 and divide by 2: quotient 5, remainder 1.
  2. Divide 5 by 2: quotient 2, remainder 1.
  3. Divide 2 by 2: quotient 1, remainder 0.
  4. Divide 1 by 2: quotient 0, remainder 1.
  5. Read the remainders from bottom to top: 1011. So 11 in decimal is 1011 in binary. Doing the same with 255 gives eight remainders of 1, which is 11111111.

Why computers use binary

Computer hardware is made of billions of tiny switches (transistors) that are either off or on. Two states map perfectly to 0 and 1, and telling two states apart is far more reliable than telling ten different voltage levels apart, especially with electrical noise.

Everything else, such as text, images, audio and video, is built on top of those bits by agreeing on how to interpret them. For example, the letter A is stored as the number 65, which is 01000001 in binary.

What is hexadecimal and why programmers use it

Hexadecimal (hex, base 16) uses sixteen symbols: the digits 0 to 9 and the letters A to F, where A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15.

Binary is precise but long and hard to read. The key fact is that one hex digit represents exactly 4 bits. So a byte (8 bits) is always two hex digits, which makes hex a compact and reliable shorthand for binary.

Quick table from 0 to 15

Decimal, binary and hex side by side. Memorizing this table makes everything else easy.

  • 0 = 0000 = 0
  • 1 = 0001 = 1
  • 2 = 0010 = 2
  • 3 = 0011 = 3
  • 4 = 0100 = 4
  • 5 = 0101 = 5
  • 6 = 0110 = 6
  • 7 = 0111 = 7
  • 8 = 1000 = 8
  • 9 = 1001 = 9
  • 10 = 1010 = A
  • 11 = 1011 = B
  • 12 = 1100 = C
  • 13 = 1101 = D
  • 14 = 1110 = E
  • 15 = 1111 = F

How to convert binary to hex

Because one hex digit equals 4 bits, no math is needed, only grouping.

  1. Split the binary number into groups of 4 bits, starting from the right. Add zeros on the left if the first group is incomplete.
  2. Convert each group using the table above.
  3. Write the hex digits in the same order.
  4. Example: 11010110 becomes 1101 and 0110. 1101 is D and 0110 is 6, so the result is D6 (also written 0xD6). In decimal that is 214.

To go from hex back to binary, just replace each hex digit with its 4 bits.

Where you see hexadecimal

  • Web colors: #FF5733 is three bytes, FF (red 255), 57 (green 87) and 33 (blue 51).
  • Memory addresses: debuggers and error messages show locations like 0x7FFE4A10.
  • MAC addresses: network cards are identified by six hex bytes, such as 00:1A:2B:3C:4D:5E.
  • Character codes and encodings: for example Unicode code points such as U+00E9, or byte dumps of files.

Common mistakes to avoid

  • Reading place values from left to right: the rightmost bit is worth 1, and values grow toward the left.
  • Grouping bits from the left instead of the right, which changes the result when the length is not a multiple of 4.
  • Forgetting leading zeros: 110 must be padded to 0110 before converting to hex.
  • Mixing up B (hex 11) with the digit 8, or D with 0, in handwritten values.
  • Confusing the number 10 in different bases: 10 in binary is 2, in decimal is 10 and in hex is 16.

Conclusion

Binary is just counting with two digits, and hex is a friendly shorthand for it where every digit stands for 4 bits. Learn the place values and the 0 to 15 table, and you can convert by hand whenever you need to. For longer values, let a converter do the work and check your result.

Frequently asked questions

What is a binary number?

A number written in base 2, using only the digits 0 and 1. Each position is worth a power of two: 1, 2, 4, 8, 16 and so on.

How many bits are in a byte?

A byte has 8 bits and can store 256 different values, from 0 to 255.

Why is hexadecimal used instead of binary?

Hex is much shorter and easier to read, and it converts to binary directly because each hex digit equals exactly 4 bits.

How do I convert 1101 0110 to hex?

Convert each 4-bit group separately: 1101 is D and 0110 is 6, so the result is D6.

Is the binary to hex converter free and private?

Yes. It is free and runs entirely in your browser, so the values you type are never sent to a server or stored.

Free tools mentioned in this article

Keep reading

All articles