๐Ÿ”ข Number Base Converter

Last updated: December 8, 2025

Number Base Converter

Convert between Binary, Octal, Decimal & Hexadecimal โ€” with live positional breakdown

Digits: 0โ€“9
Conversion Results
BIN โ€”
OCT โ€”
DEC โ€”
HEX โ€”
Digit-by-Digit Positional Breakdown
Binary
Octal
Hexadecimal

How to Convert Numbers Between Binary, Octal, Decimal, and Hexadecimal

Every number you work with on a computer exists in multiple representations at the same time. The value "255" in decimal is the exact same quantity as "FF" in hexadecimal, "377" in octal, and "11111111" in binary. Computers think in binary; programmers often use hexadecimal as shorthand; and people naturally work in decimal. Understanding how to move between these bases โ€” and why each one exists โ€” is one of the most practical skills in computing, networking, and electronics.

What Is a Number Base (Radix)?

A number base, also called a radix, tells you how many distinct digit symbols a positional numbering system uses before it "rolls over" and adds a new position. Decimal uses base 10, meaning digits 0 through 9. Once you reach 9 and add 1, you carry into the next position: 9 + 1 = 10. Binary works identically, except it only has two symbols โ€” 0 and 1 โ€” so a carry happens at 2. Octal carries at 8. Hexadecimal carries at 16, which is why it borrows the letters A through F to represent the values 10 through 15 in a single digit.

The key insight is that every digit in a positional system is multiplied by its base raised to the power of its position. The rightmost digit is position 0 (base^0 = 1), the next is position 1 (base^1 = base), and so on. All conversions rely on this single rule.

Step 1 โ€” Converting Any Base to Decimal

The most universal path is to first convert your source number into decimal, then convert from decimal into your target base. Converting to decimal is straightforward: multiply each digit by its place value and sum them up.

Take the binary number 1011. Reading from right to left, the digits occupy positions 0, 1, 2, and 3.

  • 1 ร— 2โฐ = 1 ร— 1 = 1
  • 1 ร— 2ยน = 1 ร— 2 = 2
  • 0 ร— 2ยฒ = 0 ร— 4 = 0
  • 1 ร— 2ยณ = 1 ร— 8 = 8

Sum: 8 + 0 + 2 + 1 = 11 in decimal.

The same rule applies to hexadecimal. Take 2F. The digit F has a decimal value of 15, and 2 is just 2.

  • F ร— 16โฐ = 15 ร— 1 = 15
  • 2 ร— 16ยน = 2 ร— 16 = 32

Sum: 32 + 15 = 47 in decimal.

Step 2 โ€” Converting Decimal to Any Target Base

Going the other direction uses repeated division. Divide your decimal number by the target base, record the remainder, then divide the quotient again. The remainders, read bottom to top, form the converted number.

Convert decimal 45 to binary (base 2):

  • 45 รท 2 = 22 remainder 1
  • 22 รท 2 = 11 remainder 0
  • 11 รท 2 = 5 remainder 1
  • 5 รท 2 = 2 remainder 1
  • 2 รท 2 = 1 remainder 0
  • 1 รท 2 = 0 remainder 1

Reading the remainders bottom to top: 101101. Verify: 32 + 0 + 8 + 4 + 0 + 1 = 45. Correct.

Convert decimal 200 to hexadecimal (base 16):

  • 200 รท 16 = 12 remainder 8
  • 12 รท 16 = 0 remainder 12 (= C in hex)

Reading bottom to top: C8. Verify: 12 ร— 16 + 8 = 192 + 8 = 200. Correct.

Step 3 โ€” The Binary-Octal-Hex Shortcut

When converting directly between binary, octal, and hexadecimal, you can skip the decimal step entirely by grouping binary digits.

Binary to Octal: Group binary digits into sets of 3 from right to left. Each group of 3 binary digits maps directly to one octal digit (since 2ยณ = 8).

Binary 101110 โ†’ groups: 101 and 110 โ†’ 5 and 6 โ†’ Octal 56.

Binary to Hexadecimal: Group binary digits into sets of 4 from right to left. Each group of 4 maps to one hex digit (since 2โด = 16).

Binary 10111100 โ†’ groups: 1011 and 1100 โ†’ 11(=B) and 12(=C) โ†’ Hex BC.

This shortcut makes hex a popular notation for binary data โ€” it compresses 8 binary digits into just 2 hex digits, keeping the information compact without losing any precision.

Step 4 โ€” Reading the Positional Breakdown

The breakdown panel in this converter shows you exactly what each digit contributes to the total value. Every digit card displays three things: the digit itself, the position exponent (e.g., 2ยณ), and the actual decimal value that digit adds (e.g., 8). When you add all those individual values together, you get back your original decimal number โ€” this is the proof that the conversion is correct.

Pay attention to zero digits. A 0 in any position contributes nothing (0 ร— anything = 0), but it is still essential because it shifts the other digits into higher positions. The binary number 1000 is not the same as 1 โ€” the three trailing zeros push the leading 1 into the 2ยณ position, giving it a value of 8.

Common Conversions Worth Memorizing

A handful of conversions appear so frequently in computing that most programmers internalize them:

  • 0xFF = 255 decimal โ€” the maximum value of a single unsigned byte.
  • 0x00 to 0xFF โ€” full byte range (0โ€“255), used constantly in color codes (RGB), memory addressing, and network protocols.
  • Binary 10000000 = 128 โ€” the most significant bit in an 8-bit number.
  • Octal 777 = 511 decimal โ€” file permissions in Unix/Linux (rwxrwxrwx).
  • 0x10 = 16 decimal โ€” one hex digit represents exactly 4 binary digits (a nibble).

Where Each Base Is Actually Used

Binary is the native language of digital hardware. Every transistor is either on (1) or off (0). All data โ€” text, images, video, instructions โ€” ultimately lives in memory as binary.

Octal was heavily used in older computing systems (PDP machines, early Unix) and survives today primarily in Unix file permissions. When you run chmod 755, you are writing an octal number: 7 = rwx, 5 = r-x.

Decimal is what humans use by default, and most user-facing values (port numbers, IP octets, array indices) are displayed in decimal.

Hexadecimal is the programmer's shorthand for binary. Memory addresses, color values (#1A2B3C in CSS), MAC addresses (A4:C3:F0:...), and error codes (0x80000003) are all written in hex because one hex digit maps cleanly to exactly four binary digits, making patterns instantly visible.

Tips for Avoiding Common Mistakes

The most frequent error is mixing up the source base. Always confirm which base you are reading from before converting โ€” a "10" in binary equals 2 in decimal, but a "10" in octal equals 8, and a "10" in hexadecimal equals 16. The tool on this page makes the source base explicit, which eliminates that ambiguity.

When working with hexadecimal manually, remember that A=10, B=11, C=12, D=13, E=14, F=15. Forgetting that F represents 15 (not 16) is a classic off-by-one error. Also note that hex digits are case-insensitive: "ff", "FF", and "Ff" all mean the same thing โ€” 255.

For binary, pad shorter numbers with leading zeros when grouping into nibbles (groups of 4) or bytes (groups of 8). The number 1101 is the same as 00001101 โ€” the leading zeros do not change the value but they make the grouping and alignment clearer when working with multi-byte values.

FAQ

What is the difference between binary, octal, decimal, and hexadecimal?
They are four different positional numbering systems with different bases. Binary (base 2) uses digits 0โ€“1, octal (base 8) uses 0โ€“7, decimal (base 10) uses 0โ€“9, and hexadecimal (base 16) uses 0โ€“9 plus Aโ€“F. All four can represent the exact same quantity โ€” they just use different digit symbols and place values to express it.
How do I convert a hexadecimal number to binary?
The fastest method is to convert each hex digit independently into its 4-digit binary equivalent, then concatenate the results. For example, hex 'A3' becomes 1010 (for A=10) followed by 0011 (for 3), giving binary 10100011. This works because 16 = 2โด, so each hex digit maps exactly to a group of four binary digits (a nibble).
Why does hexadecimal use letters A through F?
Hexadecimal needs 16 distinct symbols for its digits (0โ€“15). The standard digit symbols 0โ€“9 cover values 0 through 9, but we need six more symbols for values 10 through 15. The letters A, B, C, D, E, F were chosen by convention: A=10, B=11, C=12, D=13, E=14, F=15. This means a single hex digit can represent any value from 0 to 15.
What is the positional breakdown and why is it useful?
The positional breakdown shows how each digit in a number contributes its individual value to the total. Every digit is multiplied by its base raised to the power of its position (counting from 0 on the right). The breakdown makes it visually clear why a '1' in the leftmost position of a binary number is worth far more than a '1' on the right โ€” it is a different power of 2. This helps you understand conversions rather than just accepting the result.
Where is octal notation used today?
Octal is most commonly encountered in Unix and Linux file permissions. When you set permissions with chmod 755, each digit (7, 5, 5) is an octal number where each bit represents read (4), write (2), and execute (1) permission. Octal was also used heavily on older computing systems like PDP machines in the 1960sโ€“70s, which is why Unix inherited the convention.
What is the maximum number this converter supports?
This converter handles values up to 2,147,483,647, which is 2^31 โˆ’ 1 (the maximum value of a 32-bit signed integer). In hexadecimal that is 7FFFFFFF, in binary it is 31 digits of alternating bits starting with 0 followed by 30 ones. For cryptographic or arbitrary-precision needs you would need a specialized big-integer library.