Every video view, every subscriber count, and every piece of text a computer processes eventually gets reduced to a sequence of numbers stored in memory. But the way humans naturally count is not the same way a computer stores and processes data internally. Understanding number systems is the first real step toward understanding how a computer actually represents and works with information at the hardware level.
A number system is simply a way of representing numbers using a specific set of symbols and a consistent set of rules. The number system we use every day, based on ten digits from 0 to 9, feels completely natural to us, but computers are built out of electronic circuits that can only reliably distinguish between two states, such as on and off, or high voltage and low voltage. This physical limitation is exactly why computers rely on a completely different number system internally.
In this tutorial, you will learn about the four number systems most commonly discussed in Computer Organization and Architecture: decimal, binary, octal, and hexadecimal. You will also learn how to convert numbers between these systems, and understand why binary, in particular, forms the true foundation of how every computer works.
A number system is defined by its base, also called its radix, which tells you how many unique digits are available for representing values in that system. The base of a number system also determines the value of each digit's position within a number, since every position represents a power of the base.
Number: 245 (in decimal, base 10) Position values (from right): 5 × 10^0 = 5 4 × 10^1 = 40 2 × 10^2 = 200 Total: 200 + 40 + 5 = 245
This example shows how the decimal number 245 is really built from three separate digits, each multiplied by a power of ten based on its position. This same positional logic applies to every number system, only the base and the available digits change.
The decimal number system is the one we use in everyday life, built on ten digits ranging from 0 to 9, with a base of 10. Every position in a decimal number represents a power of ten, increasing from right to left.
CS Engineering Gyan subscriber count: 60000 This is a decimal number, made up of the digits 6, 0, 0, 0, and 0, using powers of 10 for each position.
While decimal feels intuitive to humans because we happen to have ten fingers, it turns out to be an inconvenient system for computer hardware to work with directly, which is where binary comes into the picture.
The binary number system uses only two digits, 0 and 1, with a base of 2. Each of these digits is referred to as a bit, short for binary digit. Binary is the true native language of computer hardware, since electronic circuits can easily represent two distinct states, such as a switch being either off or on.
Binary number: 1101 Position values (from right): 1 × 2^0 = 1 0 × 2^1 = 0 1 × 2^2 = 4 1 × 2^3 = 8 Total: 8 + 4 + 0 + 1 = 13 (in decimal)
Every single value stored inside a computer, whether it is a video's view count, a subscriber's name, or even the instructions of a running program, is ultimately represented internally using patterns of binary digits like this one.
The octal number system uses eight digits, ranging from 0 to 7, with a base of 8. Octal was historically popular in early computing because it offered a more compact way of writing binary values, since each octal digit corresponds neatly to exactly three binary digits.
Octal number: 27 Position values (from right): 7 × 8^0 = 7 2 × 8^1 = 16 Total: 16 + 7 = 23 (in decimal)
Although octal is used less frequently in modern computing compared to binary and hexadecimal, it still appears in certain contexts, such as file permission settings in Unix-based operating systems.
The hexadecimal number system uses sixteen unique symbols, the digits 0 through 9 followed by the letters A through F, where A represents 10, B represents 11, and so on up to F representing 15. Its base is 16, and it is widely used in computing because it can represent large binary values in a much shorter, more readable form.
Hexadecimal number: 2F Position values (from right): F (15) × 16^0 = 15 2 × 16^1 = 32 Total: 32 + 15 = 47 (in decimal)
Hexadecimal values are extremely common in computing, showing up in places like memory addresses, color codes, and error codes, since a single hexadecimal digit can compactly represent exactly four binary digits.
| Number System | Base | Digits Used |
|---|---|---|
| Decimal | 10 | 0 to 9 |
| Binary | 2 | 0 and 1 |
| Octal | 8 | 0 to 7 |
| Hexadecimal | 16 | 0 to 9 and A to F |
Converting a decimal number to binary is typically done by repeatedly dividing the number by 2 and recording the remainder at each step, then reading the remainders from bottom to top to form the final binary value.
Convert 45 (decimal) to binary 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 remainders bottom to top: 101101 45 (decimal) = 101101 (binary)
This division-by-two method works reliably for any decimal number, and is one of the very first conversion techniques taught in Computer Organization courses, since it directly demonstrates how positional values in binary are built up.
Converting from binary back to decimal simply involves multiplying each binary digit by the power of two corresponding to its position, then summing up all the results, exactly like the earlier example demonstrated.
Convert 101101 (binary) to decimal 1 × 2^5 = 32 0 × 2^4 = 0 1 × 2^3 = 8 1 × 2^2 = 4 0 × 2^1 = 0 1 × 2^0 = 1 Total: 32 + 8 + 4 + 1 = 45 101101 (binary) = 45 (decimal)
The same repeated-division technique used for binary also applies to octal and hexadecimal conversions, except the number is divided by 8 for octal, or by 16 for hexadecimal, instead of by 2.
Convert 100 (decimal) to octal 100 ÷ 8 = 12, remainder 4 12 ÷ 8 = 1, remainder 4 1 ÷ 8 = 0, remainder 1 Reading remainders bottom to top: 144 100 (decimal) = 144 (octal)
Convert 100 (decimal) to hexadecimal 100 ÷ 16 = 6, remainder 4 6 ÷ 16 = 0, remainder 6 Reading remainders bottom to top: 64 100 (decimal) = 64 (hexadecimal)
Because 8 and 16 are both exact powers of 2, converting directly between binary and octal, or between binary and hexadecimal, is much faster than going through decimal first. Each octal digit maps to exactly 3 binary digits, and each hexadecimal digit maps to exactly 4 binary digits.
Convert 10110101 (binary) to hexadecimal Group into sets of 4 bits, starting from the right: 1011 0101 Convert each group separately: 1011 = B 0101 = 5 10110101 (binary) = B5 (hexadecimal)
This grouping technique is exactly why hexadecimal is so useful in computing, since long, hard-to-read binary strings like 10110101 can be compressed into a much shorter, more manageable form like B5, without losing any information.
Computers are built from millions of tiny electronic switches called transistors, and each of these switches is most reliably and efficiently controlled using just two distinct states, such as low voltage representing 0, and high voltage representing 1. Trying to reliably distinguish between ten different voltage levels, the way decimal would require, would be far more complicated and error-prone at the hardware level.
This is why binary forms the true foundation of computer organization. Higher-level number systems like octal and hexadecimal are not used because the hardware itself understands them directly, but because they offer a more convenient, human-readable shorthand for representing the exact same binary values that the hardware is actually working with underneath.
| Advantages | Limitations |
|---|---|
| Binary directly matches how computer hardware physically stores and processes data. | Binary numbers become very long and hard to read for humans as values grow larger. |
| Hexadecimal offers a compact, human-friendly way to represent large binary values. | Working with multiple number systems at once can be confusing for beginners at first. |
| Octal and hexadecimal conversions from binary are quick due to their power-of-two bases. | Manual conversions between number systems are prone to small arithmetic mistakes. |
| Mistake | Correct Practice |
|---|---|
| Reading remainders from top to bottom after repeated division. | Always read the remainders from bottom to top to get the correct final result. |
| Forgetting that hexadecimal digits include letters A through F. | Remember that A equals 10, B equals 11, and so on, up to F equalling 15. |
| Grouping binary digits incorrectly while converting to octal or hexadecimal. | Group binary digits in sets of 3 for octal and sets of 4 for hexadecimal, starting from the right. |
| Mixing up the base being used partway through a calculation. | Clearly label which number system a value belongs to throughout every step of a conversion. |
Number systems form the very foundation of Computer Organization and Architecture, since every value a computer stores or processes ultimately comes down to how numbers are represented internally. Decimal is the natural system for humans, while binary is the true native language of computer hardware, built from just two digits that map directly onto electronic on and off states.
Octal and hexadecimal exist mainly as convenient, more compact ways of representing binary values, with hexadecimal in particular remaining extremely common in areas like memory addressing. Learning to confidently convert between these four systems, using techniques like repeated division and binary grouping, is an essential skill that will continue to support your understanding throughout the rest of Computer Organization and Architecture.
With number systems covered, you are now ready to move on to data representation, where these same numeric foundations are extended to cover signed numbers, complements, and how computers represent characters and floating-point values internally.