Binary, Hex & Base Converter

Number base conversion is a daily skill for software engineers and computer scientists. Binary (base 2) is how CPUs process data at the hardware level; hexadecimal (base 16) is the standard notation for memory addresses, color codes (#FF5733), and byte values in debugging. Octal (base 8) appears in Unix file permissions (chmod 755). This converter handles bases 2 through 36, supports both integer and fractional parts, and shows the step-by-step positional conversion — making it useful for learning binary arithmetic, designing low-level systems, or decoding network packet data.

star 4.8

Binary, Hex & Base Converter calculator

Decimal (Base 10)
Binary (Base 2)
1111 1111
Hex (Base 16)
FF
Octal (Base 8)
377
8-bit Visualization
1
1
1
1
1
1
1
1
128
64
32
16
8
4
2
1

lightbulb Tips

  • Binary is base-2 (0,1)
  • Hex is base-16 (0-9, A-F)
  • Octal is base-8 (0-7)

table_chart Quick Reference

Dec Bin Hex Oct
0000000 1000111 81000810 151111F17 16100001020 25511111111FF377

How to Use the Binary, Hex & Base Converter

edit

Enter Your Number

Type the number you want to convert. Use 0x, 0b, or 0o prefixes for auto-detection.

input

Select Source Base

Choose the base of your input number, or use auto-detect.

output

Choose Target Base

Select which base(s) to convert to - single base or all common bases.

visibility

View Results

See your converted number with optional step-by-step explanation.

The Formula

To convert any base to decimal, multiply each digit by the base raised to its position power, then sum all values. For example, binary 1010 = 1×2³ + 0×2² + 1×2¹ + 0×2⁰ = 8 + 0 + 2 + 0 = 10.

Value = Σ(digit × base^position)

lightbulb Variables Explained

  • digit Each digit in the number (0-9, A-Z)
  • base The number system base (2, 8, 10, 16, etc.)
  • position Position from right, starting at 0

tips_and_updates Pro Tips

1

Use prefixes to quickly enter numbers: 0b for binary, 0o for octal, 0x for hexadecimal

2

Each hexadecimal digit equals exactly 4 binary digits - useful for quick mental conversion

3

When converting large numbers, work in groups of digits for easier calculation

4

Remember: A=10, B=11, C=12, D=13, E=14, F=15 in hexadecimal

5

Binary is fundamental - all other conversions go through binary internally in computers

Convert numbers instantly between binary, hexadecimal, octal, decimal, and any base from 2 to 36. Essential tool for programmers, students, and anyone working with different number systems.

Binary to Decimal Conversion

Binary (base 2) uses only 0 and 1. To convert binary to decimal, multiply each digit by 2 raised to its position power (starting from 0 on the right) and sum the results.

Example: 1101 = 1×8 + 1×4 + 0×2 + 1×1 = 13.

Hexadecimal Conversion

Hexadecimal (base 16) uses 0-9 and A-F. It's popular in programming because each hex digit represents exactly 4 binary bits.

FF in hex = 255 in decimal = 11111111 in binary.

Why Different Number Bases?

  • Computers use binary internally.
  • Hexadecimal provides a compact way to represent binary data.
  • Octal was used in older systems.
  • Decimal is human-friendly.

Each base has its purpose in computing and mathematics.

What Is a Number Base and How Does It Work?

A number base (also called a radix) is the count of unique digits a positional number system uses to represent values. Base 10 uses ten digits (0-9); base 2 uses two (0 and 1).

In any positional system, each digit's place holds a weight equal to the base raised to that position's power, counting from zero on the right. So the decimal 253 means 2×10² + 5×10¹ + 3×10⁰.

According to Wolfram MathWorld, this positional principle lets a small set of symbols express arbitrarily large numbers, which is why base conversion is fundamentally just re-expressing the same quantity with different place values.

How to Convert Decimal to Any Base Using the Division-Remainder Method

To convert a decimal number to any target base, repeatedly divide by that base and collect the remainders, then read them from last to first.

Converting 156 to hexadecimal: 156 ÷ 16 = 9 remainder 12 (C), and 9 ÷ 16 = 0 remainder 9, so reading upward gives 9C. Verify: 9×16 + 12 = 144 + 12 = 156.

Khan Academy teaches this same divide-and-record technique for binary and other bases. It works for any radix from 2 to 36 because each division isolates the least significant digit first, building the result one place value at a time.

How to Convert Binary to Octal and Hexadecimal Quickly

Because 8 and 16 are powers of 2, you can convert binary directly by grouping bits instead of going through decimal. Group binary digits into sets of three (from the right) for octal, or sets of four for hexadecimal, padding with leading zeros as needed.

Example: binary 11010110 groups as 1101 0110 → D6 in hex, or as 011 010 110 → 326 in octal. Verify both against decimal: 214.

Wolfram MathWorld notes this grouping shortcut is exact precisely because one octal digit maps to three bits and one hex digit maps to four bits.

What Is the Positional Formula for Base Conversion?

The core formula for reading any base into decimal is Value = Σ(dₙ × baseⁿ), where each digit dₙ is multiplied by the base raised to its position n counting from zero on the right.

For hexadecimal 2AF: 2×16² + 10×16¹ + 15×16⁰ = 512 + 160 + 15 = 687.

Encyclopaedia Britannica describes this weighted-sum structure as the defining feature of positional notation, distinguishing it from non-positional systems like Roman numerals. The same formula handles fractional parts by using negative exponents, so the digit after a radix point carries a weight of base⁻¹.

Where Are Binary, Hex, and Octal Used in the Real World?

Different bases dominate different computing tasks:

  • Hexadecimal encodes memory addresses, RGB color codes like #FF5733, MAC addresses, and byte dumps because two hex digits neatly represent one 8-bit byte.
  • Octal survives in Unix file permissions: chmod 755 grants read-write-execute to the owner and read-execute to others, since each octal digit maps to three permission bits.
  • Binary underlies everything at the hardware level, from CPU logic to network subnet masks.

Understanding these bases helps programmers debug low-level data, and Britannica notes the binary system's central role in the design of all modern digital computers.

What Is Base 36 and Why Does It Use Letters?

Base 36 is the largest base that fits comfortably into the standard alphanumeric character set, using the ten digits 0-9 plus the 26 letters A-Z for values 10 through 35. That gives exactly 36 distinct symbols.

It is popular for compactly encoding large numbers as short strings, such as URL shorteners and unique IDs, because it packs more information per character than decimal or hex.

For any base above 10, letters simply extend the digit set: A=10, B=11, up through Z=35. This converter supports every base from 2 to 36 using this convention.

Common Mistakes When Converting Between Number Bases

  • The most frequent error is miscounting position exponents by starting from one instead of zero; the rightmost digit always has position 0, giving it a weight of base⁰ = 1.
  • Another common slip is forgetting to pad binary into complete groups of three or four before mapping to octal or hexadecimal, which shifts every digit.
  • People also confuse hex letters, writing D as 14 instead of 13 (A=10, B=11, C=12, D=13, E=14, F=15).
  • Finally, when using the division-remainder method, remainders must be read from the last division upward, not in the order they were produced.

Double-checking with the positional formula catches all four.

Frequently Asked Questions

sell

Tags