A computer works with information in a form that can be represented and processed by electronic circuits. At the lowest level, these circuits work with binary states, represented using 0 and 1. However, humans normally work with decimal numbers, while programmers and computer engineers frequently use hexadecimal and sometimes octal notation to make binary information easier to read.
The study of number systems is therefore an important foundation of Computer Organization and Architecture. It explains how numerical values are represented, how the value of a digit depends on its position, and how the same value can be written in different bases without changing the underlying quantity.
For example, the decimal value 25, binary value 11001, octal value 31, and hexadecimal value 19 all represent the same numerical quantity. The notation changes, but the value remains the same.
In this chapter, we will study the decimal, binary, octal, and hexadecimal number systems. We will also work through the most important conversion methods used in Computer Organization.
A number system is a method of representing numerical values using a defined set of symbols and a particular base. The base determines how many symbols are available and how the positional value of each digit is calculated.
For a positional number system, the value of a number is obtained by multiplying each digit by the appropriate power of the base and then adding the results.
If a number is written in base b, its positional values are based on:
... b³ b² b¹ b⁰
For example, consider the decimal number 352.
352 = (3 × 10²) + (5 × 10¹) + (2 × 10⁰)
= (3 × 100) + (5 × 10) + (2 × 1)
= 300 + 50 + 2
= 352
The same positional principle is used in binary, octal, and hexadecimal systems. Only the base changes.
The base, also called the radix, specifies the number of different symbols that can be used in a number system.
For example, decimal has base 10 because it uses ten symbols, from 0 to 9. Binary has base 2 because it uses only 0 and 1.
| Number System | Base | Symbols |
|---|---|---|
| Decimal | 10 | 0–9 |
| Binary | 2 | 0, 1 |
| Octal | 8 | 0–7 |
| Hexadecimal | 16 | 0–9, A–F |
A useful rule is that the largest valid digit in a base-b system is b − 1. Therefore, 8 and 9 are not valid digits in octal, while hexadecimal can use values from 0 through 15.
The decimal number system is the standard system used in everyday counting and calculations. It has a base of 10 and uses the ten digits from 0 to 9.
Each position represents a power of 10. Moving one position toward the left increases the positional value by a factor of 10.
582 = (5 × 10²) + (8 × 10¹) + (2 × 10⁰) = (5 × 100) + (8 × 10) + (2 × 1) = 500 + 80 + 2 = 582
Decimal notation is convenient for people, but computer hardware normally represents numerical information internally using binary.
The binary number system has base 2 and uses only two digits: 0 and 1. A single binary digit is called a bit.
Binary is fundamental to digital computer systems because electronic circuits can be designed to operate using two distinguishable logical states. These states can be represented in different physical ways depending on the technology, such as lower and higher voltage levels.
Position: 2³ 2² 2¹ 2⁰ Value: 8 4 2 1
1011₂ = (1 × 2³) + (0 × 2²) + (1 × 2¹) + (1 × 2⁰) = 8 + 0 + 2 + 1 = 11₁₀
Therefore:
1011₂ = 11₁₀
Binary representation is used throughout computer systems for values such as integer data, machine instructions, control information, and encoded data.
A bit can contain either 0 or 1. When multiple bits are combined, they can represent a larger number of possible patterns.
| Number of Bits | Number of Possible Patterns | Unsigned Range |
|---|---|---|
| 1 | 2 | 0 to 1 |
| 2 | 4 | 0 to 3 |
| 4 | 16 | 0 to 15 |
| 8 | 256 | 0 to 255 |
For n bits, the number of possible binary patterns is:
2ⁿ
For an unsigned n-bit value, the range is:
0 to (2ⁿ − 1)
This relationship becomes particularly important when studying data representation, registers, memory addresses, and processor architecture.
The octal number system uses base 8 and contains eight digits: 0 through 7.
Octal provides a compact representation of binary information because eight is a power of two:
8 = 2³
Consequently, every octal digit corresponds to exactly three binary bits.
347₈ = (3 × 8²) + (4 × 8¹) + (7 × 8⁰) = (3 × 64) + (4 × 8) + (7 × 1) = 192 + 32 + 7 = 231₁₀
Octal notation is less common in general-purpose modern computing than hexadecimal, but it still appears in areas such as Unix and Linux file permission notation.
The hexadecimal number system uses base 16. It requires sixteen symbols, so the digits 0 through 9 are followed by the letters A through F.
| Hex Digit | Decimal Value | Binary |
|---|---|---|
| 0 | 0 | 0000 |
| 1 | 1 | 0001 |
| 2 | 2 | 0010 |
| 3 | 3 | 0011 |
| 4 | 4 | 0100 |
| 5 | 5 | 0101 |
| 6 | 6 | 0110 |
| 7 | 7 | 0111 |
| 8 | 8 | 1000 |
| 9 | 9 | 1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |
2A₁₆ = (2 × 16¹) + (A × 16⁰) A = 10 = (2 × 16) + (10 × 1) = 32 + 10 = 42₁₀
Hexadecimal is particularly useful because one hexadecimal digit represents four binary bits:
1 hexadecimal digit = 4 binary bits
This makes long binary values significantly easier for humans to read and write.
Octal and hexadecimal are especially convenient because their bases are powers of two.
Octal: 8 = 2³ Hexadecimal: 16 = 2⁴
Therefore, binary values can be converted directly to octal by grouping bits into sets of three, and directly to hexadecimal by grouping bits into sets of four.
Binary Octal 000 0 001 1 010 2 011 3 100 4 101 5 110 6 111 7
Binary Hexadecimal 0000 0 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 0111 7 1000 8 1001 9 1010 A 1011 B 1100 C 1101 D 1110 E 1111 F
One common method for converting an integer from decimal to binary is repeated division by 2. At each step, the remainder is recorded. The process continues until the quotient becomes zero. The binary answer is obtained by reading the remainders from bottom to top.
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
Now read the remainders from the last division toward the first:
101101
Therefore:
45₁₀ = 101101₂
To convert an unsigned binary number into decimal, multiply each bit by its corresponding power of 2 and add the resulting values.
110101₂ = (1 × 2⁵) + (1 × 2⁴) + (0 × 2³) + (1 × 2²) + (0 × 2¹) + (1 × 2⁰) = 32 + 16 + 0 + 4 + 0 + 1 = 53
Therefore:
110101₂ = 53₁₀
For an integer conversion from decimal to octal, repeatedly divide the number by 8 and record each remainder.
125 ÷ 8 = 15 remainder 5 15 ÷ 8 = 1 remainder 7 1 ÷ 8 = 0 remainder 1
Reading the remainders upward:
175₈
Therefore:
125₁₀ = 175₈
The same repeated-division technique can be used for hexadecimal, but the divisor is 16. Remainders from 10 to 15 are represented by A through F.
254 ÷ 16 = 15 remainder 14 15 ÷ 16 = 0 remainder 15
The decimal value 14 is E and 15 is F.
254₁₀ = FE₁₆
Because each octal digit represents three binary bits, the conversion can be performed by grouping the binary number into groups of three starting from the right.
The binary number contains seven bits. Add leading zeros if necessary so that the total number of bits can be divided into groups of three.
1101011 011 010 11
A clearer grouping is:
001 101 011
Now convert each group:
001 = 1 101 = 5 011 = 3
Therefore:
1101011₂ = 153₈
Binary-to-hexadecimal conversion uses groups of four bits. If the number of bits is not a multiple of four, zeros are added to the left.
1011 0110 1011 = B 0110 = 6
Therefore:
10110110₂ = B6₁₆
This direct grouping method is one reason hexadecimal is widely used when working with binary-oriented information.
The reverse operation is equally simple. Replace every hexadecimal digit with its four-bit binary equivalent.
3 = 0011 D = 1101
Therefore:
3D₁₆ = 00111101₂
Leading zeros may be omitted when the binary value is written without a fixed width:
3D₁₆ = 111101₂
Each octal digit corresponds to three binary bits. Therefore, every octal digit can be replaced directly with its three-bit representation.
5 = 101 7 = 111 2 = 010
Combining the groups:
572₈ = 101111010₂
Number systems are not limited to whole numbers. Fractions can also be represented using positional notation. For digits to the right of the radix point, the powers of the base become negative.
101.101₂ = (1 × 2²) + (0 × 2¹) + (1 × 2⁰) + (1 × 2⁻¹) + (0 × 2⁻²) + (1 × 2⁻³) = 4 + 0 + 1 + 0.5 + 0 + 0.125 = 5.625₁₀
This illustrates an important point: the same positional principle works on both sides of the radix point. The difference is that fractional positions use negative powers of the base.
For a decimal fraction between 0 and 1, a common conversion technique is repeated multiplication by 2. The integer part obtained at each step becomes the next binary fractional bit.
0.625 × 2 = 1.250 Integer part = 1 0.250 × 2 = 0.500 Integer part = 0 0.500 × 2 = 1.000 Integer part = 1
Reading the integer parts in order:
0.625₁₀ = 0.101₂
Binary is ideal for hardware but becomes difficult for humans to read when a value contains many bits. Hexadecimal solves this readability problem without changing the underlying binary information.
Consider the following 16-bit binary value:
1101011010111100
Writing the same value in hexadecimal requires only four digits:
1101 0110 1011 1100 D 6 B C = D6BC₁₆
The hexadecimal representation is considerably shorter while preserving every bit of information.
This is why hexadecimal notation frequently appears when representing memory addresses, machine-level values, debugging information, byte-oriented data, and other low-level computer information.
| System | Base | Main Symbols | Binary Relationship | Typical Use |
|---|---|---|---|---|
| Binary | 2 | 0, 1 | Native digital representation | Digital logic and machine-level representation |
| Octal | 8 | 0–7 | 1 digit = 3 bits | Some legacy and Unix-related notation |
| Decimal | 10 | 0–9 | No direct power-of-two grouping | Human-readable numerical values |
| Hexadecimal | 16 | 0–9, A–F | 1 digit = 4 bits | Addresses, debugging and low-level representation |
Let us represent the decimal value 42 in all four systems.
42₁₀
42 ÷ 2 = 21 remainder 0 21 ÷ 2 = 10 remainder 1 10 ÷ 2 = 5 remainder 0 5 ÷ 2 = 2 remainder 1 2 ÷ 2 = 1 remainder 0 1 ÷ 2 = 0 remainder 1 42₁₀ = 101010₂
42 ÷ 8 = 5 remainder 2 5 ÷ 8 = 0 remainder 5 42₁₀ = 52₈
42 ÷ 16 = 2 remainder 10 10 = A 42₁₀ = 2A₁₆
Therefore, the same value can be written as:
42₁₀ = 101010₂ = 52₈ = 2A₁₆
This is the central idea behind number-system conversion: the representation changes, but the numerical value does not.
Number systems are not an isolated mathematical topic in Computer Organization. They are used throughout the subject.
Because of these connections, a strong understanding of number systems makes later topics such as data representation, registers, memory organization, instruction formats, and digital logic easier to understand.
| Conversion | Method |
|---|---|
| Decimal → Binary | Repeatedly divide by 2 and read remainders upward. |
| Binary → Decimal | Multiply each bit by its corresponding power of 2 and add. |
| Decimal → Octal | Repeatedly divide by 8 and read remainders upward. |
| Decimal → Hexadecimal | Repeatedly divide by 16 and replace 10–15 with A–F. |
| Binary → Octal | Group binary bits into sets of three from the right. |
| Binary → Hexadecimal | Group binary bits into sets of four from the right. |
| Octal → Binary | Replace each octal digit with three binary bits. |
| Hexadecimal → Binary | Replace each hexadecimal digit with four binary bits. |
Several ideas in number systems are especially important because they appear repeatedly in Computer Organization questions and practical calculations.
A base-2 number cannot contain the digit 2. Similarly, a base-8 number cannot contain 8 or 9. Every digit must be smaller than the base.
The same digit can have different values depending on its position. In decimal 505, the first 5 represents hundreds while the last 5 represents units.
Digital hardware ultimately works with binary states. Decimal, octal, and hexadecimal are alternative notations that help humans express values more conveniently.
One hexadecimal digit corresponds to four binary bits. This makes conversion between these two systems particularly straightforward.
One octal digit corresponds to three binary bits. This relationship comes directly from the fact that 8 is equal to 2³.
A number system is a method of representing numerical values using a particular base and set of symbols. Computer Organization commonly uses binary, decimal, octal, and hexadecimal systems.
Binary uses two states, 0 and 1, which can be represented by two distinguishable states in digital electronic circuits. It therefore forms the foundation of digital computer hardware.
Binary has base 2 and uses only the digits 0 and 1.
Octal has base 8 and uses the digits 0 through 7.
Hexadecimal has base 16 and uses 0 through 9 and A through F.
Hexadecimal needs sixteen symbols. After 0 through 9 provide ten symbols, A through F provide the remaining six symbols, representing decimal values 10 through 15.
One hexadecimal digit represents four binary bits because 16 = 2⁴.
One octal digit represents three binary bits because 8 = 2³.
Starting from the right, divide the binary digits into groups of four. Convert each four-bit group into its corresponding hexadecimal digit.
A bit is a single binary digit containing either 0 or 1. A byte commonly consists of eight bits.
Number systems provide the notation required to understand how numerical information is represented at different levels of a computer system. Decimal is convenient for human calculations, while binary provides the fundamental representation used by digital hardware. Octal and hexadecimal provide shorter ways of writing binary information and are particularly useful when studying computer hardware and low-level data.
The most important skill is not simply memorizing the bases. You should understand how positional values work and be able to move confidently between representations. Repeated division is useful for converting decimal integers, positional expansion converts binary or other-base numbers back to decimal, and grouping makes binary-to-octal and binary-to-hexadecimal conversion much faster.
These concepts provide the mathematical foundation for the next topics in Computer Organization. Once number representation is clear, it becomes easier to understand how computers represent signed numbers, characters, floating-point values, and other forms of data internally.