Math

Number Base Converter

Binary Octal Decimal Hex. Fast, accurate, and completely free.

Favorites

Recent Tools

Results
Binary (Base 2)
Octal (Base 8)
Decimal (Base 10)
Hexadecimal (Base 16)

Mathematical Formula

N_{10} = \sum_{i=0}^{n-1} d_i \times b^i

N10 = decimal equivalent of the number

di = digit at position i (from right, starting at 0)

b = base of the source number system

n = total number of digits

How to Use this Calculator

  1. Enter the number you want to convert into the input field.

  2. Select the source base (Binary, Octal, Decimal, or Hexadecimal) from the dropdown.

  3. View all four converted values displayed simultaneously below.

  4. Review the step-by-step breakdown to understand how the conversion was performed.

Understanding Number Base Conversion

Number base conversion is a fundamental concept in computer science and mathematics. Every number system uses a specific base (or radix) that determines the number of unique digits available and how positional values are calculated. The four most commonly used number systems in computing are binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16).

The Decimal System We Know

The decimal system is the number system we use in everyday life. It uses ten digits (0 through 9), and each position represents a power of 10. For example, the number 347 means 3 times 100, plus 4 times 10, plus 7 times 1. This positional notation principle extends to every other number base as well.

Binary: The Language of Computers

Binary uses only two digits: 0 and 1. Each digit is called a bit (binary digit). Computers use binary because electronic circuits have two stable states: on and off. Every piece of data in a computer, from text to images to videos, is ultimately represented in binary. The binary number 11010, for example, equals 26 in decimal because it represents 1×16 + 1×8 + 0×4 + 1×2 + 0×1.

Octal: A Compact Shorthand

Octal uses digits 0 through 7. It was historically popular in computing because it provides a concise way to represent binary data. Each octal digit corresponds exactly to three binary digits (bits). For instance, the binary number 110101 can be split into groups of three from right to left (110 and 101), giving octal 65. While less common today than hexadecimal, octal still appears in Unix file permission systems and some programming contexts.

Hexadecimal: The Programmer's Favorite

Hexadecimal uses sixteen symbols: 0-9 and A-F (where A=10, B=11, C=12, D=13, E=14, F=15). It is widely used in computing because each hex digit maps to exactly four binary bits, making it a very compact way to express binary values. For example, the binary byte 11111111 is simply FF in hexadecimal and 255 in decimal. Hexadecimal is commonly seen in color codes (like #FF5733), memory addresses, and debugging output.

How Conversion Works

The general method for converting between any two bases involves two steps. First, convert the source number to decimal by multiplying each digit by the base raised to its positional power, then summing the results. Second, convert from decimal to the target base by repeatedly dividing by the target base and recording remainders. The remainders, read in reverse order, form the converted number.

Practical Applications

Understanding number base conversion is essential for programmers, network engineers, and hardware designers. Web developers use hexadecimal color codes daily. System administrators work with octal permissions on Unix-like operating systems. Embedded systems engineers frequently need to read binary sensor data or memory dumps. Even in cybersecurity, analyzing network packets often requires reading hexadecimal data.

Grouping Shortcuts

There are convenient shortcuts when converting between bases that are powers of 2. To convert binary to octal, group binary digits into sets of three from right to left. To convert binary to hexadecimal, group into sets of four. These shortcuts work because 8 is 2 cubed and 16 is 2 to the fourth power, creating a direct digit-to-group mapping. This makes mental conversion much faster once you memorize the small lookup tables for each grouping.

  • Binary to Octal: group 3 bits per octal digit
  • Binary to Hex: group 4 bits per hex digit
  • Octal to Binary: expand each octal digit into 3 bits
  • Hex to Binary: expand each hex digit into 4 bits

Mastering number base conversion deepens your understanding of how computers store and process data, and it is a critical skill in any computer science curriculum or technical interview.

Frequently Asked Questions (FAQ)

What is a number base or radix?

A number base (or radix) is the number of unique digits used in a positional numeral system. For example, decimal is base 10 because it uses digits 0-9, while binary is base 2 because it uses only 0 and 1. The base determines how much each digit position is worth.

Why do computers use binary instead of decimal?

Computers use binary because electronic circuits are most reliable with two distinct states: on (1) and off (0). This two-state system maps perfectly to binary and is easier to manufacture, less prone to errors, and simpler to design logic gates for compared to circuits that would need to distinguish ten different voltage levels for decimal.

What are valid digits for hexadecimal numbers?

Hexadecimal (base 16) uses the digits 0-9 for values zero through nine, and the letters A-F (or a-f) for values ten through fifteen. So the valid characters are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F.

How do I convert a large binary number to hex quickly?

Group the binary digits into sets of four from right to left, padding the leftmost group with leading zeros if needed. Then convert each group of four bits to its corresponding hex digit. For example, 110110101111 becomes 1101 1010 1111, which is D-A-F or DAF in hexadecimal.

Can this converter handle fractional or negative numbers?

This converter is designed for non-negative whole numbers (integers). Fractional number conversion and negative number representations like two's complement involve additional complexity and are not supported by this particular tool.

Where is octal numbering used in practice?

Octal is most commonly seen in Unix and Linux file permission systems. Permissions like 755 or 644 are octal numbers where each digit represents read, write, and execute permissions for owner, group, and others. Octal was also historically used in older computing systems and some programming languages like C (e.g., 077 is an octal literal).

Explore more tools you might find useful