Binary Calculator: Binary, Decimal, and Hexadecimal Conversion Explained

📅 April 12, 2026 ⏱️ 10 min read 📚 Computer Science

Every time you send a text message, browse a website, or run an app, your device is silently crunching numbers in binary — a number system made up of just 0s and 1s. Understanding binary, decimal, and hexadecimal number systems is foundational knowledge for computer science, programming, networking, and digital electronics. This guide explains each system, teaches you how to convert between them, and shows you where a binary calculator can save you time and errors.

Understanding Number Systems (Bases)

A number system's "base" (or "radix") tells you how many unique digits it uses. The position of each digit determines its value through powers of the base. This is called positional notation, and it's the principle behind all the number systems we'll discuss.

Decimal (Base-10)

The decimal system is what humans use every day. It has ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Each position represents a power of 10. The number 425 means 4 × 100 + 2 × 10 + 5 × 1 = 400 + 20 + 5.

Binary (Base-2)

Binary uses only two digits: 0 and 1. Each position represents a power of 2. The binary number 1101 means 1 × 8 + 1 × 4 + 0 × 2 + 1 × 1 = 13 in decimal. Binary is the native language of all digital computers because electronic circuits naturally have two states: on and off.

Hexadecimal (Base-16)

Hexadecimal (or "hex") uses sixteen digits: 0–9 and A–F (where A=10, B=11, C=12, D=13, E=14, F=15). Each position represents a power of 16. Hex is widely used as a compact, human-readable representation of binary data, since each hex digit corresponds exactly to 4 binary bits.

Decimal to Binary Conversion

Converting from decimal to binary involves repeatedly dividing by 2 and recording the remainders.

Method: Division by 2

  1. Divide the decimal number by 2
  2. Record the remainder (0 or 1)
  3. Divide the quotient by 2
  4. Repeat until the quotient reaches 0
  5. Read the remainders from bottom to top
Example: Convert 42 to binary.
42 ÷ 2 = 21 remainder 0
21 ÷ 2 = 10 remainder 1
10 ÷ 2 = 5 remainder 0
5 ÷ 2 = 2 remainder 1
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1
Reading bottom to top: 101010
Verification: 1×32 + 0×16 + 1×8 + 0×4 + 1×2 + 0×1 = 32 + 8 + 2 = 42 ✓

Method: Subtraction of Powers of 2

Alternatively, find the largest power of 2 that fits in your number, subtract it, and place a 1 in that position. Continue with the remainder. For 42: the largest power of 2 ≤ 42 is 32 (2⁵). Place 1 in the 32s position. Remainder: 10. Next power: 8 (2³). Place 1 in the 8s position. Remainder: 2. Next power: 2 (2¹). Place 1 in the 2s position. Result: 101010.

Binary to Decimal Conversion

Converting from binary to decimal is straightforward: multiply each digit by its corresponding power of 2 and add them up.

Decimal = dₙ × 2ⁿ + dₙ₋₁ × 2ⁿ⁻¹ + ... + d₁ × 2¹ + d₀ × 2⁰
Example: Convert 11010 to decimal.
1×16 + 1×8 + 0×4 + 1×2 + 0×1 = 16 + 8 + 0 + 2 + 0 = 26
Example: Convert 10110101 to decimal.
1×128 + 0×64 + 1×32 + 1×16 + 0×8 + 1×4 + 0×2 + 1×1
= 128 + 32 + 16 + 4 + 1 = 181

Decimal to Hexadecimal Conversion

The process mirrors decimal-to-binary, but you divide by 16 instead of 2.

  1. Divide the decimal number by 16
  2. Record the remainder (0–15; use A–F for 10–15)
  3. Divide the quotient by 16
  4. Repeat until the quotient reaches 0
  5. Read the remainders from bottom to top
Example: Convert 255 to hexadecimal.
255 ÷ 16 = 15 remainder 15 (F)
15 ÷ 16 = 0 remainder 15 (F)
Reading bottom to top: FF
Example: Convert 43981 to hexadecimal.
43981 ÷ 16 = 2748 remainder 13 (D)
2748 ÷ 16 = 171 remainder 12 (C)
171 ÷ 16 = 10 remainder 11 (B)
10 ÷ 16 = 0 remainder 10 (A)
Reading bottom to top: ABCD

Hexadecimal to Decimal Conversion

Multiply each hex digit by its corresponding power of 16 and sum them. Remember that A=10, B=11, C=12, D=13, E=14, F=15.

Example: Convert 2F3 to decimal.
2×256 + 15×16 + 3×1 = 512 + 240 + 3 = 755

Binary to Hexadecimal (and Back)

This is the easiest conversion because of the clean 4-to-1 relationship: every 4 binary digits map to exactly 1 hex digit.

Binary to Hex

  1. Group binary digits into sets of 4, starting from the right
  2. Pad the leftmost group with leading zeros if needed
  3. Convert each 4-bit group to its hex equivalent
Example: Convert 10111010110 to hex.
Group: 101 1101 0110
Pad: 0101 1101 0110
Convert: 5 D 6
Result: 5D6

Hex to Binary

Simply convert each hex digit to its 4-bit binary equivalent. This is often the fastest path when you need to convert between decimal and binary — go through hex as an intermediate step.

Example: Convert BEEF to binary.
B=1011, E=1110, E=1110, F=1111
Result: 1011111011101111

Quick Reference: Binary ↔ Hex

BinaryDecimalHex
000000
000111
001022
001133
010044
010155
011066
011177
100088
100199
101010A
101111B
110012C
110113D
111014E
111115F

Convert between binary, decimal, and hex instantly:

Free Binary Calculator →

Binary Arithmetic

Just like decimal numbers, binary numbers can be added, subtracted, multiplied, and divided. Binary arithmetic follows the same principles but with only two digits.

Binary Addition

There are four possible scenarios when adding two binary digits:

Example: Add 1011 + 1101
   1011 (11)
+ 1101 (13)
------
 11000 (24)

Binary Subtraction

Binary subtraction uses borrowing, just like decimal subtraction:

Binary Multiplication

Binary multiplication is simpler than decimal multiplication because you're only ever multiplying by 0 or 1. Any number times 0 is 0; any number times 1 is itself. Multiply each digit of one number by the other, shifting left for each position, then add the results.

Example: Multiply 101 × 11
   101
×  11
------
  101 (101 × 1)
101  (101 × 10, shifted)
------
1111 (15)

Why Binary Matters: Real-World Applications

Computer Architecture

At the hardware level, every operation a computer performs — from rendering graphics to processing text — is reduced to binary operations. Transistors act as switches that are either on (1) or off (0), and combinations of billions of these switches form the logic gates that power modern processors.

IP Addresses and Networking

IPv4 addresses (like 192.168.1.1) are stored and processed as 32-bit binary numbers. Understanding binary is essential for subnetting — dividing a network into smaller segments. Subnet masks (255.255.255.0, for example) are binary patterns that determine which part of an IP address identifies the network and which identifies the host.

Color Codes

Web colors are expressed in hexadecimal. The color #8B5CF6 (the purple used on this page) represents 139 red, 92 green, and 246 blue in decimal. Each pair of hex digits controls one color channel, ranging from 00 (0) to FF (255). Understanding hex makes working with colors in web design, graphic design, and video editing much more intuitive.

File Formats and Magic Numbers

File types are identified by "magic numbers" — specific byte sequences at the beginning of a file. PDF files start with 25 50 44 46 (hex) which spells "%PDF" in ASCII. JPEG files begin with FF D8 FF. Understanding hex lets you inspect and identify files at the binary level.

Memory Addresses

Every byte in a computer's memory has a unique address, typically expressed in hexadecimal. When you see addresses like 0x7FFE9A4B2C10 in debugging tools, that's a hex representation of a binary memory location. Hex is used because it's compact enough to read at a glance while maintaining a direct, clean mapping to binary.

Bits, Bytes, and Common Binary Measurements

UnitSizeCommon Use
Bit1 binary digitSmallest unit of data
Nibble4 bitsOne hex digit
Byte8 bitsOne character (ASCII)
Kilobyte (KB)1,024 bytesSmall text file
Megabyte (MB)1,024 KBPhoto, short video
Gigabyte (GB)1,024 MBMovie, large app
Terabyte (TB)1,024 GBHard drive capacity

Note that in computing, these prefixes use powers of 2 (1,024 = 2¹⁰) rather than the standard powers of 10 (1,000). This is why a "500 GB" hard drive shows up as about 465 GB in your operating system — the drive manufacturer uses decimal gigabytes while your computer uses binary gibibytes.

Common Mistakes to Avoid

When to Use a Binary Calculator

While understanding the manual conversion process is valuable for learning and interviews, a binary calculator is the practical choice for real work. Use one when:

Conclusion

Binary, decimal, and hexadecimal are three different lenses for viewing the same underlying numbers. Decimal is natural for humans, binary is native to computers, and hexadecimal bridges the gap as a compact, readable format. Whether you're studying computer science, configuring networks, designing web interfaces, or simply satisfying your curiosity, understanding these number systems — and having a reliable binary calculator at hand — is an essential skill.

Frequently Asked Questions

How do you convert decimal to binary?

Divide the decimal number by 2 repeatedly, recording the remainders. Read the remainders from bottom to top. For example, 25 ÷ 2 = 12 R1, 12 ÷ 2 = 6 R0, 6 ÷ 2 = 3 R0, 3 ÷ 2 = 1 R1, 1 ÷ 2 = 0 R1. Reading bottom to top: 11001.

Why do computers use binary instead of decimal?

Computers use binary because electronic circuits have two states: on (1) and off (0). This binary system maps naturally to transistors, which are the building blocks of all digital electronics. It's simpler and more reliable than trying to represent 10 different voltage levels.

What is hexadecimal used for?

Hexadecimal (base-16) is used as a human-readable shorthand for binary. Since each hex digit represents exactly 4 binary bits, it's perfect for representing memory addresses, color codes (like #FF5733), MAC addresses, and debugging data.

How do you convert binary to hexadecimal?

Group the binary digits into sets of 4 (starting from the right). Convert each 4-bit group to its hex equivalent: 0000=0, 0001=1, ..., 1010=A, 1111=F. For example, 10101100 → 1010 1100 → AC in hex.

What is the difference between binary and decimal?

Decimal (base-10) uses ten digits (0-9) and is what humans use daily. Binary (base-2) uses only two digits (0-1) and is what computers use internally. Every decimal number can be represented in binary and vice versa — they're just different ways of writing the same value.