Understanding number bases is essential to grasp how computers represent and manipulate data in various systems using binary and hexadecimal formats efficiently.
What is a number base?
A number base, also called a radix, is the total number of unique digits (including zero) used to represent values in a positional number system. Each number base has its own set of digit symbols, and the position of each digit determines its actual contribution to the value of the whole number.
In any base-n system, digits range from 0 up to (n − 1).
In base-10 (decimal), the digits used are 0 to 9.
In base-2 (binary), only 0 and 1 are used.
In base-16 (hexadecimal), digits go from 0 to 9 and then continue with letters A to F, representing values 10 to 15.
The number base defines how numbers are constructed and interpreted. Changing the base changes the way we write and read numbers, although the underlying value they represent stays the same. Each base has specific uses, and understanding their characteristics is crucial in the field of computing.
Positional number systems
Practice Questions
FAQ
Binary numbers become longer than their decimal equivalents because binary uses only two digits (0 and 1), while decimal uses ten. As a result, more binary digits are needed to represent the same value. For example, the decimal number 255 is just three digits long, but its binary equivalent is 11111111, which is eight digits. This length increase is because binary grows exponentially more slowly than decimal. Every new binary digit only doubles the range of representable values, while in decimal, each digit increases the range tenfold. The implication in computing is that while binary is ideal for electronic processing, storing large numbers directly in binary requires more memory space. It also makes binary values harder for humans to read and interpret. To counteract this, hexadecimal is often used as a shorthand, condensing long binary sequences into a compact, readable form. This helps with debugging, addressing, and visualising binary-coded data.
Yes, negative numbers can be represented using binary through systems such as two's complement, which is the most widely used method in modern computing. In two's complement, the most significant bit (leftmost) is used to indicate the sign of the number: 0 for positive and 1 for negative. The range of values that can be represented depends on the number of bits. For instance, using 8 bits, two's complement allows values from -128 to +127. The concept of number bases still applies because each digit’s place value is still based on powers of two, but the interpretation of the most significant bit is modified to indicate negativity. This approach allows binary addition and subtraction to work seamlessly for both positive and negative numbers. Even though the representation method changes, it still fundamentally relies on positional values in base-2. This preserves the efficiency and logic operations that underpin binary arithmetic in computing systems.
Bases higher than hexadecimal, like base-32 or base-64, are indeed used but typically in specialised contexts rather than standard computing systems. These higher bases are less practical for general system-level computing because they require more complex symbol sets. For example, base-64 uses uppercase and lowercase letters, digits, and special characters such as '+' and '/'. This makes encoding and decoding more computationally intensive and less human-friendly. In contrast, hexadecimal uses only 16 easily recognisable characters (0–9 and A–F), offering a good balance between compactness and simplicity. High bases are mostly used in data encoding schemes, such as Base64, which is common in email attachments, URL-safe encodings, and image embedding in web development. These contexts involve transferring binary data through systems that only support printable characters. For internal memory representation, hexadecimal remains optimal because it aligns neatly with 4-bit binary groupings, enabling straightforward conversion, minimal overhead, and improved readability for developers.
The concept of place value in non-decimal bases like octal (base-8) works in the same way as it does in decimal or binary. Each digit in a number is multiplied by the base raised to the power of its position index, starting from 0 on the right. For example, the octal number 147₈ can be evaluated as (1 × 8^2) + (4 × 8^1) + (7 × 8^0), which equals 64 + 32 + 7 = 103 in decimal. Octal was historically relevant in computing, particularly with early systems that used 12-bit, 24-bit, or 36-bit word lengths, as octal aligns neatly with 3-bit binary groupings. One octal digit equals three binary digits, simplifying conversions and improving readability. Although hexadecimal is more common today due to its alignment with 4-bit groupings in modern hardware, understanding place value in any base is important for grasping how computers interpret and manipulate numbers in various encoding systems and programming environments.
Decimal is not efficient or practical for addressing or internal computation in digital systems due to both hardware and logic constraints. Firstly, representing decimal numbers would require digital circuits to reliably distinguish between ten voltage levels (one for each digit), which is far more complex and prone to error than the two levels required for binary (on and off). This would increase the cost, size, and power consumption of digital hardware. Secondly, implementing arithmetic operations in hardware for decimal is more complex and less efficient than binary logic, which can be executed using simple gates and flip-flops. While decimal is intuitive for human users, it does not align with the binary nature of digital circuitry. As a result, data entered in decimal by users must be converted into binary for computation, and then converted back into decimal for display. This introduces overhead, but the benefits of simpler, more robust binary hardware outweigh the limitations of converting between number bases.
