Skip to content

Binary, Hexadecimal, and Number Systems Explained

CalculatorGlobe Team February 23, 2026 13 min read Math

Every number you encounter in daily life uses the decimal system, but computers, programmers, and engineers constantly work with alternative number bases. Binary powers every digital device, hexadecimal simplifies how developers read machine-level data, and octal still appears in Unix file permissions.

This guide explains how positional number systems work, walks through the four most important bases, and teaches you to convert between them with confidence.

What Are Number Systems?

A number system (or numeral system) is a method of representing numbers using a consistent set of symbols and rules. The key concept behind the number systems used in computing is positional notation, where the value of a digit depends on its position within the number.

In the decimal number 753, the digit 7 represents 7 × 10² = 700, the digit 5 represents 5 × 10¹ = 50, and the digit 3 represents 3 × 10° = 3. Each position corresponds to a power of the base (10 in this case). This same principle applies to every positional number system, whether the base is 2, 8, 16, or any other positive integer.

The base (or radix) of a number system determines how many unique digits it uses and the multiplier for each position. Base 10 uses digits 0 through 9. Base 2 uses only 0 and 1. Base 16 uses 0 through 9 plus the letters A through F.

The Four Major Number Bases

Binary (Base 2)

Binary is the foundation of all digital computing. It uses exactly two digits: 0 and 1, called bits (binary digits). Every piece of data in a computer, from a text document to a streaming video, is ultimately stored and processed as sequences of bits.

In binary, each position represents a power of 2. Reading from right to left, the positions represent 1, 2, 4, 8, 16, 32, 64, 128, and so on.

Binary Place Values

Position: 7 6 5 4 3 2 1 0

Value: 128 64 32 16 8 4 2 1

Example: 10110101 in binary = 128 + 32 + 16 + 4 + 1 = 181 in decimal

The binary number 10110101 means: (1 × 128) + (0 × 64) + (1 × 32) + (1 × 16) + (0 × 8) + (1 × 4) + (0 × 2) + (1 × 1) = 181.

Computers use binary because digital circuits operate with two voltage states. A transistor is either on (1) or off (0). This binary state is the most reliable way to store information electronically, since distinguishing between two states is far more noise-resistant than distinguishing between ten states.

Octal (Base 8)

Octal uses digits 0 through 7. Each octal digit corresponds to exactly three binary digits, making it a convenient shorthand for binary when the context calls for it.

The most common modern use of octal is in Unix and Linux file permissions. When you set permissions using a command like chmod 755, each digit is an octal number. The digit 7 (binary 111) grants read, write, and execute permissions, while 5 (binary 101) grants read and execute only.

Octal to Binary Mapping

0 = 000

1 = 001

2 = 010

3 = 011

4 = 100

5 = 101

6 = 110

7 = 111

Decimal (Base 10)

Decimal is the number system you use every day. It uses ten digits (0 through 9) and each position represents a power of 10. The prevalence of base 10 is likely connected to humans having ten fingers, which provided a natural counting tool for early civilizations.

While decimal is intuitive for human calculation, it is not inherently superior to other bases mathematically. It simply became the standard because of our anatomy. Different cultures have used bases 5, 12, 20, and 60 throughout history, each with its own advantages.

Hexadecimal (Base 16)

Hexadecimal (often shortened to "hex") uses sixteen symbols: the digits 0 through 9 and the letters A through F, where A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15.

Each hexadecimal digit represents exactly four binary digits (bits), because 16 = 2&sup4;. This makes hex the preferred shorthand for binary in computing. A single byte (8 bits) can be represented by exactly two hex digits, ranging from 00 to FF (0 to 255 in decimal).

Hexadecimal to Binary Mapping

0 = 0000

1 = 0001

2 = 0010

3 = 0011

4 = 0100

5 = 0101

6 = 0110

7 = 0111

8 = 1000

9 = 1001

A = 1010

B = 1011

C = 1100

D = 1101

E = 1110

F = 1111

You encounter hex values in web development (HTML color codes like #3B82F6), memory addresses (0x7FFF5FBFF8A0), MAC addresses (00:1A:2B:3C:4D:5E), and debugging output. Wherever raw binary data needs to be displayed in a human-readable format, hexadecimal is the standard choice.

Try Our Binary Calculator

Perform addition, subtraction, multiplication, and division on binary numbers with step-by-step solutions.

Use Calculator

How to Convert Between Number Bases

Converting between number bases is a core skill in computer science and digital electronics. The two most common conversions are decimal to binary and binary to hexadecimal.

Decimal to Binary Conversion

The repeated division method converts any decimal number to binary. Divide the number by 2 repeatedly, recording each remainder. The binary result is the remainders read from bottom to top.

Example: Convert 156 to Binary

156 ÷ 2 = 78 remainder 0

78 ÷ 2 = 39 remainder 0

39 ÷ 2 = 19 remainder 1

19 ÷ 2 = 9 remainder 1

9 ÷ 2 = 4 remainder 1

4 ÷ 2 = 2 remainder 0

2 ÷ 2 = 1 remainder 0

1 ÷ 2 = 0 remainder 1

Read remainders bottom to top: 10011100

Verify: 128 + 16 + 8 + 4 = 156

To convert from binary back to decimal, multiply each bit by its positional power of 2 and sum the results. This is the expansion method.

Binary to Hexadecimal Conversion

Converting between binary and hex is straightforward because each hex digit maps to exactly four bits. Group the binary digits into sets of four (starting from the right), then replace each group with its hex equivalent.

Example: Convert 10011100 to Hexadecimal

Step 1: Group into 4-bit chunks: 1001 | 1100

Step 2: Convert each group: 1001 = 9, 1100 = C

Result: 10011100 in binary = 9C in hexadecimal

Verify: 9 × 16 + 12 = 144 + 12 = 156 (matches our decimal)

For binary numbers whose length is not a multiple of four, pad with leading zeros. For example, 110101 becomes 0011 0101, which converts to 35 in hex.

Try Our Base Converter

Convert numbers between any bases from 2 to 36 with detailed step-by-step explanations.

Use Calculator

Practical Examples

Number system conversions arise constantly in technology, design, and networking. Here are three scenarios that demonstrate these skills in action.

Example 1: Nadia Decodes an HTML Color

Nadia is a web designer working with the color code #2C8F4E. She needs to understand the RGB values for a design specification.

Red channel (2C): 2 × 16 + 12 = 44

Green channel (8F): 8 × 16 + 15 = 143

Blue channel (4E): 4 × 16 + 14 = 78

Result: RGB(44, 143, 78) — a forest green color with dominant green channel. Nadia uses these decimal values in her CSS rgba() function to add transparency to the color.

Example 2: James Sets Unix File Permissions

James needs to set file permissions on his web server so the owner can read, write, and execute; the group can read and execute; and others can only read.

Owner: read (4) + write (2) + execute (1) = 7 (binary: 111)

Group: read (4) + execute (1) = 5 (binary: 101)

Others: read (4) = 4 (binary: 100)

Command: chmod 754 filename

The complete binary permission string is 111 101 100. Each octal digit compactly represents three permission bits, making octal the natural choice for this task.

Example 3: Yuki Analyzes a Network Packet

Yuki is debugging a network issue and sees the hex value 0xC0A80164 in a packet capture. She needs to determine the IP address.

Split into bytes: C0 | A8 | 01 | 64

Convert each byte:

C0 = 12 × 16 + 0 = 192

A8 = 10 × 16 + 8 = 168

01 = 0 × 16 + 1 = 1

64 = 6 × 16 + 4 = 100

Result: The IP address is 192.168.1.100 — a standard private network address. Yuki identifies this as a local device on the 192.168.1.x subnet.

Number Base Reference Table

This table provides a quick reference for common values across the four major number systems. Keep it handy when performing conversions or reading technical documentation.

Decimal Binary Octal Hexadecimal Common Use
0 0000 0 0 Null / false
1 0001 1 1 True / on
10 1010 12 A Newline character (ASCII)
16 10000 20 10 One hex digit boundary
127 1111111 177 7F Max signed byte
255 11111111 377 FF Max unsigned byte
1,024 10000000000 2000 400 1 KB (kibibyte)
65,535 1111111111111111 177777 FFFF Max 16-bit unsigned

Tips and Complete Guide

Mastering number system conversions requires practice, but these strategies will help you work faster and avoid errors.

  • Memorize the 4-bit binary-to-hex table. There are only 16 entries (0000 through 1111 mapping to 0 through F). Once memorized, you can convert between binary and hex instantly without any arithmetic.
  • Learn powers of 2 up to 2¹². Knowing that 2¹&sup0; = 1,024 and 2¹&sup6; = 65,536 gives you immediate reference points for evaluating binary numbers and understanding memory sizes.
  • Always verify conversions. After converting a number, convert it back to the original base to confirm your result. If 156 in decimal becomes 9C in hex, verify by calculating 9 × 16 + 12 = 156.
  • Use prefix notation to avoid ambiguity. In programming and documentation, use 0b for binary (0b10011100), 0o for octal (0o234), and 0x for hexadecimal (0x9C). This prevents confusion about which base a number uses.
  • Group binary digits for readability. Long binary strings are hard to read. Group them in fours (for hex conversion) or eights (for bytes): 1001 1100 is much easier to parse than 10011100.
  • Practice with real data. Decode hex color codes, read IP addresses from packet dumps, or convert file permissions to binary. Working with real-world examples reinforces the patterns far better than abstract exercises.

Common Mistakes to Avoid

  • Reading remainders in the wrong direction. When converting decimal to binary using repeated division, the first remainder is the least significant bit (rightmost). Read the remainders from bottom to top, not top to bottom.
  • Forgetting to pad binary groups. When converting binary to hex, if the leftmost group has fewer than four bits, pad it with leading zeros. Otherwise you will map the wrong binary pattern to the hex digit.
  • Confusing hex letters with decimal digits. The hex value 10 equals decimal 16, not decimal 10. Always be explicit about which base you are using, especially in written communication.
  • Mixing up A-F values. A common error is thinking A = 1 instead of A = 10. Remember: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
  • Ignoring signed vs unsigned representation. In computing, the same binary pattern can represent different decimal values depending on whether it is interpreted as signed or unsigned. The byte 11111111 is 255 unsigned but -1 in signed two's complement notation.

Try Our Hex Calculator

Perform arithmetic operations on hexadecimal numbers with instant results and binary equivalents.

Use Calculator

Frequently Asked Questions

Computers use binary because digital circuits operate with two voltage states: high (on) and low (off). These two states map perfectly to the binary digits 1 and 0. Representing ten distinct voltage levels for decimal digits would be unreliable, since electrical noise could cause the circuit to misread one level as another. Binary provides the most noise-resistant and energy-efficient way to store and process information electronically.

Hexadecimal is a shorthand for binary. Each hexadecimal digit represents exactly four binary digits (bits), because 16 equals 2 to the fourth power. For example, the hex digit F represents the binary group 1111. This makes it easy to convert between the two systems without arithmetic. Programmers use hex to make long binary strings more readable, such as writing memory addresses and color codes.

In web design, colors are specified using six hexadecimal digits in the format #RRGGBB, where each pair represents the red, green, and blue light intensity from 00 (none) to FF (maximum, which equals 255 in decimal). For example, #FF0000 is pure red, #00FF00 is pure green, and #FFFFFF is white. This system provides 16,777,216 possible color combinations, giving designers precise control over every pixel on screen.

Octal was widely used when computers had word sizes of 12, 24, or 36 bits, which divide evenly into groups of three bits. Modern computers predominantly use 8-bit bytes and 32-bit or 64-bit words, which divide evenly into groups of four bits matching hexadecimal. Since hexadecimal aligns better with contemporary hardware architectures, it largely replaced octal in everyday programming, though octal still appears in Unix file permissions and some legacy systems.

Yes, all standard arithmetic operations work in binary following the same rules as decimal, but with only two digits. In binary addition, 0 plus 0 equals 0, 0 plus 1 equals 1, 1 plus 0 equals 1, and 1 plus 1 equals 10 (zero with a carry of 1). Subtraction, multiplication, and division follow analogous rules. Computers perform billions of these binary arithmetic operations per second to execute every calculation and program instruction.

Base conversion is the process of expressing the same numerical value using a different set of digit symbols and positional weights. In base 10, each position represents a power of 10. In base 2, each position represents a power of 2. The underlying quantity remains identical; only the representation changes. Converting between bases involves either repeated division by the target base or expanding the number as a sum of positional values and recalculating.

Many number bases have been used throughout history. The Babylonians used base 60 (sexagesimal), which survives in our 60-second minute and 360-degree circle. The Mayan civilization used base 20 (vigesimal). In computing, base 64 encoding is used to represent binary data in text-safe formats. Any positive integer greater than 1 can serve as a number base, and the choice depends on what is most practical for a given application.

Sources & References

  1. Wolfram MathWorld — Mathematical reference on hexadecimal number system: mathworld.wolfram.com
  2. Encyclopaedia Britannica — Comprehensive article on numerals and numeral systems: britannica.com
  3. Encyclopaedia Britannica — Reference article on the binary number system: britannica.com
  4. Wolfram MathWorld — Mathematical reference on binary numbers: mathworld.wolfram.com
Share this article:

CalculatorGlobe Team

Content & Research Team

The CalculatorGlobe team creates in-depth guides backed by authoritative sources to help you understand the math behind everyday decisions.

Related Calculators

Related Articles

Disclaimer: This calculator is for informational and educational purposes only. Results are estimates and may not reflect exact values.

Last updated: February 23, 2026