Skip to Main Content

Introduction


By now, we all know how to count. But can you count in Binary, or Hexadecimal? How about add, subtract, multiply and divide in a different number system?

We take it for granted that we work with a Base 10 (decimal) number system, and until we encounter a different number system (such as binary or hexadecimal) we probably don’t even realise that anything other than base 10 even exists or is possible. The reality however is that the use of base 10 in our colloquial number systems is completely arbitrary and probably originated simply because we have 10 fingers (for counting with), and other number systems are just as valid. If we had 12 fingers then we would probably all be using a base 12 number system.

Base 10 (or Radix 10) means that there are 10 possible values for each digit:

0,1,2,3,4,5,6,7,8,9

Once we run out of possible values for a single digit, then we add another digit:

Decimal
1 0

And so on..

Again, we take all of this for granted since we have learnt it from the earliest age. Once we understand the basic mechanism of how this works however, then it becomes clear that other number systems are just as logical and valid.

Binary


Computers, internally, work on switches (transistors), which can have only one of 2 states: on or off. This means that there are only 2 possible values for each digit in the computer-world (0, 1), and computers thus need to work with a Base 2 (binary) number system. When counting in binary, the same rule applies – once we run out of possible values for a single digit, then we add another digit:

Binary
1 0

Here's a quick run down comparison to help clarify:

Base 2 (Binary) Base 10 (Decimal)
0 0
1 1
10 2
11 3
100 4
101 5
110 6
111 7
1000 8
1001 9
1010 10
1011 11
1100 12

Hexadecimal


Hexadecimal uses Base 16, meaning that there are 16 possible values for each digit:

0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

Here's a side by side comparison of all three to help clarify:

Base 2 (Binary) Base 10 (Decimal) Base 16 (Hexadecimal)
0 0 0
1 1 1
10 2 2
11 3 3
100 4 4
101 5 5
110 6 6
111 7 7
1000 8 8
1001 9 9
1010 10 A
1011 11 B
1100 12 C
1101 13 D
1110 14 E
1111 15 F
1 0000 16 10
1 0001 17 11
1 0010 18 12
1 0011 19 13
1 010 20 14

Hexadecimal is popular in the computer world because it translates conveniently with the binary which computers work with. Each hexadecimal digit translates to 4 binary digits:

Base 2 (Binary) Base 16 (Heaxadecimal)
0 0
1 1
1111 F
1 0000 10
1 0001 11
1111 1111 FF
1 0000 0000 100
1 0001 0001 111
10 0010 0010 222

Prefixes


Computers internally also generally work on multiples of 8-bits (8-bits = 1 byte), so each byte can be conveniently represented with 2 hexadecimal digits. This is easier for engineers to work with than long sequences of binary digits, however the computer still works on the base 2 binary number system internally. In programming languages, types of number systems are generally identified with a prefix – for example in the C programming language:

Base 2 (Binary) Base 10 (Decimal) Base 16 (Hexadecimal)
0b00000000 0 0x00
0b00000001 1 0x01
0b00001010 10 0x0A
0b11111111 255 0xFF

Note that the leading zeroes are not mandatory (0b00000001 is the same as just 0b1, and 0x01 is the same as just 0x1) however they are often used to ease readability in context.

In summary, different number systems are easy to understand once the number-system-principles are understood. You might argue that Decimal is better than Binary becase less digits are needed to represent any particular number, but by that reasoning Hexadecimal would be better than Decimal. The reality is that we like Decimal simply because that is what we are used to, and what everyone else is used to.

All content Copyright Labcenter Electronics Ltd. 2024. Please acknowledge Labcenter copyright on any translation and provide a link to the source content on www.labcenter.com with any usage.

Advanced Simulation

Learn more about our built in graphing and advanced simulation features. Harness the mixed-mode simulation engine in Proteus to quickly test your analogue or digital circuitry directly on the schematic.

Ask an Expert Icon Ask An Expert

Have a Question? Ask one of Labcenters' expert technical team directly.

Find the right package for you

Product Wizard Try Proteus