# How to count

[#cnthexbn]: Counting in decimal, binary, and hexadecimal
Browser compatability

This is a technical note about viewing this text (rather than being about the math).

This web page makes use of a “down arrow” character. It may look like this: “”. Hopefully that is easily recognized as a down arrow, and is just one character wide. If using a text mode browser that renders that as multiple characters, it might be worthwhile to modify this web page's HTML by replacing `&dArr;` with a capital letter V. Otherwise, perhaps this is one page that using a graphical web browser will result in a notably enhanced experience.

Overview

With decimal, there are ten digits: zero through nine. With binary, there are just two digits: zero and one. With hexadecimal, there are sixteen digits. The first then of those digits are represented with the numbers zero through nine, and the rest of the digits are represented with the letters A through F. (Hexadecimal numbers have commonly been written with uppercase letters, particularly with i386 assembly code, and also commonly with lowercase letters, especially with IPv6 addresses. The case does not change the value, so B in hexadecimal is the same as b in hexadecimal.)

Common usage

The main purposes of how these numbering systems are used: decimal (base 10) is used worldwide as a general number system. Binary reflects how computers operate. Hexadecimal is a shorter way to display and write any character regardless of its binary value, and it is easy and fast to convert with binary (even with big numbers, once the trick is known: see the super-fast converting between binary and hexadecimal section for details).

For example, a character representing the binary value of 1111010 can be written in decimal as 122 or hexadecimal as 7A. Another popular way to render that character is to use a character map: Standard ASCII will result in this looking like the lowercase letter z. However, not all 8-bit characters are so easy to type on most keyboards as that lowecase letter. Some characters may not be as easy to distinguish from other characters (when displayed in their most common rendering), including the relatively common patterns of all zeros and all ones (which typically both look completely blank). Some characters may have special meanings (such as being treated like a control code when sent to a printer, or being treated like an escape character), although letters and numbers may be treated normally. All of these potential technical troubles are alleviated by using hexadecimal.

[#digitnam]: Terminology Note

Terminology note: The number 10 may commonly be read as “one zero”. We do not normally refer to this number as “ten” even though it looks like a one followed by a zero. Such names for numbers might be used, but when they are, they typically refer to their decimal values. The binary value of 10, which is one higher than the binary value of 1, for reasons that will be explained momentarily. This number, which is one higher than the binary value of one, may actually be sensibly referred to somewhat commonly by the name “two”. The number uses the standard name, even though the standard name is based on decimal, and even though no number will ever use the character 2 when writing out in standard binary digits.

Similarly, in hexadecimal A may be referred to as ten, and 1A may be referred to as “twenty six”, but is not commonly referred to as “A-teen”. I know, when using hexadecimal it might be fun to call the number “one hundred twenty seven” by the name “seventy-F”, and use numbers like “E-teen” for thirty (which is written out as 1E hexadecimal), but such nonsense is not common, and trying to use a non-standard approach unexpectedly, and especially inconsistently, may yield confusion. Those wishing the avoid disdain/loathing/annoyance by adults in the profession are generally recommended to avoid using such nonsense terms. In the case of many instructors, such disdain might equal lower grades.

For multi-digit numbers, a common approach is simply to state each digit individually. For long numbers, the common way to deal with that verbally is to avoid saying the number verbally. Instead, such numbers are typically written, and then assigned a name or reference such as “that first number that is being displayed on the screen”.

[#howincrm]: How to count (a.k.a. increment)

Adding one (also known as “counting” or “counting up”) and subtracting one (also known as “counting down”) in binary and hexadecimal follow the same patterns as counting up and down in decimal.

This guide will start by showing how things are done in decimal. This is very simple: young children are taught how to do this (when they are taught how to “carry” an overflowed value, so the extra “carried” value will then affect the next greater/larger “decimal place”). The reason we're starting off with something that people know extremely well is to demonstrate some specific patterns. Because binary and hexadecimal use the same patterns, this will make understanding binary and hexadecimal much easier.

[#incrdec]: Counting up in decimal

The phrase “decimal” refers to “base ten”, which means that we have ten digits:

 0 1 2 3 4 5 6 7 8 9

If we start at 0 and count up by one, we simply use the next possible value of a digit. When this is done, the “least-significant” digit gets increased from a zero to a one. (In the United States of America, the “least-significant” digit is most commonly the digit in the right-most column.)

Mathematically, counting from zero to one is the same in decimal as it is with binary or hexadecimal.

We continue the pattern until we reach the last digit on our available number line of digits. In decimal, that digit is 9. After that, we cannot just use the next digit in the number line, because we have exceeded the number of digits on the number line. So, what do we do?

Counting up from Nine to Ten (Decimal)
Steps (when written out fully)
Step One >>> Step Two >>> Step Three
 9 + 1 ===
 1    9 + 1 ==⇓   0
 1   ⇓9 +⇓1 =⇓=  10
Commentary:

In Step 1, we realize the goal is to add nine plus one.

In step #2, we have exceeded the right-most digit's maximum value. So, in the answer, we wrap around to zero. We also carry a 1, which we write above as a “carried” number.

In Step #3, the carried digit gets added to the invisible leading zeros. In practice, the carried 1 just gets brought straight down, getting written in the answer section.

Now, it may be helpful if you don't think of the answer as “ten”. Instead, think of the answer as “zero, with a one in front of it”. The reason to call it “zero, with a one in front of it” is that this will help when understanding the other systems.

So far, does this math seem like simple stuff? Many people may have learned this even before reaching an age that was large enough to need to carry a digit into the second decimal place. The reason this is being reviewed in such detail is that clearly identifying these simple behaviors is expected to help in understanding the other number systems.

Now that we have identified the process of carrying to create a multi-digit number, let's expand on that slightly, by going triple-digits. Then it will be time to see how things work in binary.

Step One Step Two Step Three Step Four
 99 +  1 ====

 1    99 +  1 ===⇓    0
 11    99 + ⇓1 ==⇓=   00
 11   ⇓99 +⇓ 1 =⇓==  100

Steps #1 and #2 are essentially performed the same way as the last example. In this example, at the end of step #2, we have a carried 1. So in Step #3, we add that carried 1 to the number lower in the same column, which is a 9. This resulted in writing a 0 in the answer, and again result in carrying a digit.

[#incrbin]: Counting up in binary
The visual guide

This version of the guide is probably more clear for people without relative familiarity with this topic. (Following this more “visual” guide is an older guide that covered much of this in straight text.)

Now, the big trick to binary is that we have just two digits. Like all of the larger number systems, we start with 0 and then 1. At that point, though, we have already used up all of the digits. So, the number line basically looks like this:

 0 1

(The “1” is the last number in this binary number line, just like the “9” was the last number in the decimal number line.)

So, the start counting, we simply start with the lowest value possible for a digit: zero (0). Then, in order to add one, the process is fairly simple: just add one. Use the next possible value for a digit.

Incrementing from Zero to One
Step One Step Two
 0 + 1 ===
 0 + 1 ==⇓   1

So far, the numeric values of this counting is all the same in binary as it would be with decimal or hexadecimal. However, the next iteration will be different.

Now, the next time we try to increment (from the number 1), this process does get a little more complicated in binary. With decimal, we simply advance to the next number on the number line. So, in decimal, we simply say 1+1=2. However, with binary, we are at the maximum value for a digit. When we try to add one again, there are no more possible values on the number line that we can just increase to. So, this is more complicated than what we do in decimal.

So, since we are at the maximum value supported by a single digit, we carry.

Counting past 1 in binary
Step One Step Two Step Three
 1 + 1 ===
 1    1 + 1 ==⇓   0
 1   ⇓1 +⇓1 =⇓=  10

The way this gets resolved in binary is just like when using another base such as base ten (decimal). We lower the value of the digit that we're focused on back to the lowest value (as seen in step #2), and then we increase the next most significant digit. The result is, like when we ran out of the number line in decimal, “zero, with a one in front of it”.

So, in binary, the number two is written out as “10”. So when “10” is representing a value written out in binary, this does NOT represent the number “ten”. So, this is a bit different than decimal. However, like decimal, the number we reach after using up the entire available single-digit number line is “zero, with a one in front of it”.

Since that is what two looks like, written out in binary, then what does three look like? That's easy enough: Increasing to the next number will involve just increasing the right-most digit. So, this is nice and simple counting.

Increasing from Two to Three (in Binary)
Step One Step Two Step Three
 10 + 1 ===
 10 + 1 ==⇓   1
 10 +⇓1 =⇓=  11
Recapping what was just shown

Be careful not to say that the answer is “eleven”. The answer is, “one, with a one in front of it”. For now, reading the number that way will help to achieve clarity very soon.

So, like decimal, what comes after “zero, with a one in front of it”? The answer will looke nice and simple: 10+1=11. The trick here is to NOT say “ten plus one equals eleven”. Since we are dealing with binary numbers, that isn't a ten, and that other number isn't an eleven. The easy way to handle this, for now, is to just forget about trying to read multiple digits at once. Instead, simply read that math statement digit by digit. The result: “one-zero plus one is one-one”. When you read it out that way, that should make intuitive sense because the process really doesn't even look any different than decimal math.

What comes after “zero, with a one in front of it” is what we would like to expect: “one, with a one in front of it”. answer is “one, with a one in front of it”. Since there was another number available in the number line, the actual math process is, pretty-much, as simple as it can be.

Moving on

Now, the next part will get more complicated again: In binary, every time we go from an odd number to an even number, we're going to need to carry. So we end up carrying values pretty frequently.

To increase from 11, the number we are starting with has two digits. Both digits are at their maximum value. This is the same situation as what we would have if we started with 99 in decimal. And, we approach this situation the same way.

Increment from Three to Four (in Binary)
Step One Step Two Step Three Step Four
 11 +  1 ====
 1    11 +  1 ===⇓    0
 11    11 + ⇓1 ==⇓=   00
 11   ⇓11 +⇓ 1 =⇓==  100

In the first step, we are simply identifying the math that we are going to do. In the second step, we add the right-most column. Since we have surpassed the maximum value, what we do is wrap around to zero for the answer, and we carry a one. In Step #3, we show the results of adding that carried one: we end up exceeding the maximum value of the digit, so we wrap around to zero and we carry another one. In Step #4, we take the final carried one and add it to the invisible leading zeros, effectively dropping the number straight down to the section where the answer is written.

The next addition is going from an even number to an odd number, so it is very simple. We simply increase the right-most digit to the next value on our number line. (Step #2 is the only step with much action in this example.)

Counting from Four to Five (in  Binary)
Step One Step Two Step Three Step Four
 100 +  1 ====
 100 +  1 ===⇓    1
 100 + ⇓1 ==⇓=   01
 100 +⇓ 1 =⇓==  101

At this point, many people seem to think they may be understanding the process, but would like to see it just a bit more to confirm their understanding. So, here are the results of some more incrementation:

Incrementing from Five to Six (in Binary)
Step One Step Two Step Three Step Four
 101 +  1 ====
 1   101 +  1 ===⇓    0
 1   101 + ⇓1 ==⇓=   10
 1   101 +⇓ 1 =⇓==  110

Incrementing from Six to Seven (in Binary)
Step One Step Two Step Three Step Four
 110 +  1 ====
 110 +  1 ===⇓    1
 110 + ⇓1 ==⇓=   11
 110 +⇓ 1 =⇓==  111

Incrementing from Seven to Eight (in Binary)
Step One Step Two Step Three Step Four Step Five
 111 +   1 =====
 1    111 +   1 ====⇓     0
 11    111 +  ⇓1 ===⇓=    00
 111    111 + ⇓ 1 ==⇓==   000
 111   ⇓111 +⇓  1 =⇓===  1000

Incrementing from Eight to Nine (in Binary)
Step One Step Two
 1000 +   1 =====
 1000 +   1 ====⇓  1001

Visually, the steps for the following numbers really start to look like what has already been done.

A great way to really start to feel comfortable is to start from scratch, and count in binary from zero through seventeen. Once that can be done fairly quickly, then the skill is likely understood.

When working with computers, being able to rapidly count up to fifteen can be very useful for quickly converting from binary to single-digit or even multi-digit hexadecimal numbers.

Some older text

(This text came from an earlier version of this guide. For those who want to try a different perspective, this more abbreviated method might help. Or, just seeing this again, presented a bit differently, might help re-inforce a concept.)

0+1=1. Simple enough?

At this point, we have used up all of the visible digits. Just like in binary, we may be able to use an invisible leading zero. So we'll treat the 1 as being equivilent to 01. Then we have enough digits, so we can proceed to add one. The least-significant digit becomes its lowest value zero, and the next most significant digit is increased to the next higher value. Written out, that looks like 01 + 1 = 10. If that's confusing, read on because two more iterations may help this to make more sense.

Moving on, let's do two more iterations.

To count up from 10, we simply add one to the least significant digit, so it starts to look like 11 (which is typically referred to as “one one”, or perhaps “three”, but not as “eleven”). That probably doesn't look confusing at all for people used to adding decimal numbers.

Now, for the next iteration, to increase from 11, the number is again out of values for each digit, because binary has only two values for each digit: zero and one. Keep in mind that one is the maximum value of each digit is a one. It may help to think of this very similar to the number ninety nine in decimal: 99.

Since we are at the maximum value of for the digit, we need to complete a two-part process. The first part is that we decrease the least-most-significant digit to the lowest value, a zero. So the number is temporarily thought of as 10 (for the binary example). (For the decimal example, this would be like setting the number temporarily to look like 90.) However, we're not done until we also complete the second part of the process, which is that we need to take care of the “carry-over” increase by increasing the next number over. So the second digit also needs to have one added.

Since the next digit over is (in both the binary and the decimal examples) at its maximum digit, we'll set that digit to a zero, increase the number of digits as needed, and increase the next digit over. When we increase the third digit from a (previously invisible leading) zero to a one, after we reduced the other two digits to a zero, the result when written out looks like 100, a one followed by two zeros.

To compare, in the decimal numbering scheme, 100 is reached after adding one to ninety nine (99), and the result is typically called “one hundred”. In the binary numbering scheme, 100 is typically reached after adding one to three (11), and the result is typically called “four”.

So, already, by the time we hit the number four, binary is already requiring three digits. That's one thing about binary. The number two hundred and fifty five looks like FF in hexadecimal, 255 in decimal, and 11111111 in binary. In all cases, hexadecimal has the same or less number of digits than decimal, and decimal has the same or less number of digits as binary. As early as three, binary always has more digits than decimal (and hexadecimal).

The only part of this demonstration which might be a little bit bad is the assumption that there are an infinite amount of leading zeros available. In some cases that is true. In many cases where binary values are actually used, that is not true. However, there is typically at least a certain, perhaps limited, number of leading zeros. For example, a 32-bit number set to the binary value of 1 has 31 leading zeros that may be used as needed. If additional digits are needed but are not available, the term is called “overflow”. Overflow handling (by setting a certain bit and wrapping) is a bit more complicated of a topic, and so will be discussed separately.

[#incrhex]: Counting up and/or adding in hexadecimal
The visual guide

The basic concept of hexadecimal is simply that there are sixteen values in each “hexadecimal place”. This simply means that there are sixteen characters in the number line. Because traditional arabic numerals only has ten symbols for us to use, we need six more symbols. Traditionally, we use letters. So, the number line looks something like this:

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

That's the quick summary for hexadecimal.

Numeric terminology

One way to remember how many digits are in hexadecimal is to just look at the word. The greek prefix “hexa” means six. (For example, a hexagon is a six-sided polygon.) In the International System of Units, the prefix (famously used by the metric measuring system) deci means “tenth”. (Deca means “ten”.) The word “decimal” refers to “base ten”. The word “hexadecimal” refers to using a base of “six and ten”, which is sixteen.

Some people think of “hex” as meaning six. In that case, perhaps the first letter “a” in “hexadecimal” may be thought of as an abbreviation for “and”. However, in reality, the “hex” prefix is itself just an abbreviation for “hexa”.

Confusingly, many people who are familiar with hexadecimal will abbreviate the quadrasyllabic word down to just the first syllable: “hex”. So, the abbreviated prefix “hex” will often refer to “hexadecimal” (while the non-abbreviated prefix “hexa” should refer to six, not sixteen).

Assembly language programmers would typically suffix hexadecimal with a letter h (so 21,930 decimal may be written out as 55AAh). Programmers using the computer programmer language known as C used a multi-character prefix of 0x. So, 21,930 decimal would be written out as 0x55AA.

Mathematicians may be more inclined to use a subscript to denote the base. (So, if subscripts are supported, “316” is what 0x3 would be written out as.)

[#hexvalus]: Written hexadecimal notation

Unfortunately, there is not absolutely universal consensus on what the hexadecimal digits should look like. Sometimes the digits are shown in uppercase. Sometimes they may be shown in lowercase. Either way, the numbers have the same value. So, really, there may be multiple number lines:

 Binary Decimal Hexadecimal(uppercase) Hexadecimal(lowercase) English(Written) 0 0 0 0 Zero 1 1 1 1 One 10 2 2 2 Two 11 3 3 3 Three 100 4 4 4 Four 101 5 5 5 Five 110 6 6 6 Six 111 7 7 7 Seven 1000 8 8 8 Eight 1001 9 9 9 Nine 1010 10 A a Ten 1011 11 B b Eleven 1100 12 C c Twelve 1101 13 D d Thirteen 1110 14 E e Fourteen 1111 15 F f Fifteen

(There is another table, showing the equivilent values between the different base systems, at the section about converting between binary and hexadecimal.)

There is no mathematical difference between a capital hexadecimal letter and a lowercase one. There are some standards: Assembly language (for x86, at least) is traditionally uppercase and RFC 5952 Errata ID # 2656 documents several other books (some published as early as the 1960s) that suggest uppercase is standard. However, the same Errata ID shows that the IPv6 working group had a “clear consensus” to use lowercase. Neither standard is followed universally. Well-designed software and humans should both be able to interpret uppercase and lowercase hexadecimal digits as having the same value.

This inconsistency is an unfortunate, though not terribly surprising, result of the decision to use letters. The primary reason why letters are used, rather than some other unique shapes to act like the other digits, is probably just because the letters have keys on a typical keyboard (including both computers, and those older things known as typewriters). Having a readily available key is one advantage. Another useful advantage is that there is some pre-existing familiarity regarding the order of the shapes, so many people don't need to try very hard to remember the order of the larger digits. These are probably the primary reasons why the shapes of letters have been used for the shapes of the larger digits. Confusion between the digits above nine, and actual alpha letters, is a negative result of the choice to use letters. Also, the confusion about case (uppercase vs. lowercase) would not have been an issue if other symbols (e.g. !@#\$%&) were used. So, there are some negative results: people probably just considered the positive consequences to be more impactful than the negative consequences.

Sometimes hexadecimal numbers may be shown with colons. In at least some cases, the colons are just pointless seperators, and have no mathematical value. This is similar to other separators, such as if an American uses a comma in the number 1,000. (Some other nations operate using a period for that purpose, and use the comma as a decimal point.) As an example: in a fully expanded IPv6 address, the colons have no meaning. (However, a double-colon in an abbreviated notation may have significance.) In BSD-style notation, a MAC address may have colons after every pair of hexadecimal digits. That same style may also be used when Firefox shows a digital certificant's “key” fingerprint/signature. In these examples, the colons have no real significance.

Abbrviated text guide

Once binary is understood, this guide can teach counting up in hexadecimal in just a few sentences; rather instantly. (Even if there is no real immediate desire to learn binary, binary is easier than hexadecimal to see how this works in a more quick manner. So, learning binary first probably is the fastest way to pick this up in hexadecimal.) So, first, become familiar with counting up in binary.

From zero to nine, this works just like decimal. Then, although decimal maximizes at the digit value of nine (“9”), hexadecimal doesn't. So while decimal would need to add a digit, hexadecimal and just keep using available values for digits. 9 + 1 = A, A + 1 = B, B + 3 = E, and E + 1 = F. (That was abbreviated: For the full list, see the number lines above. They effectively show early values for a hexadecimal to binary conversion chart.) After that point (after F, hexadecimal runs out of digits, so we add another digit just like binary or hexadecimal. F + 1 = 10. Since F is equivilent to the decimal number fifteen, adding 1 results in 10 which is equivilent to decimal number sixteen.

Here are some additional examples of adding. This isn't meant to be a chart to memorize, but for people learning hexadecimal it is recommended to consult this chart to verify that each one of these addition statements makes sense. If each one of these makes sense, then the concept of how hexadecimal counts up is probably fully understood. If not, it may be good to use a translator to convert the smaller number into decimal and then manually count in hexadecimal to see how the addition worked. (One way to do that is to use newer versions of Windows `Calc.exe` and using the View called Programmer. Then select the radio button that says “Hex”.)

These examples are provided in rows. (There is no signicant meaning to the columns.) These are simply some true mathematical statements.

10 + 1 = 11, 11 + 8 = 19,
19 + 1 = 1A, 1A + 5 = 1F,
1F + 1 = 20, 20 + 9 = 29,
29 + 6 = 2F, 2F + 1 = 30,
30 + B = 3B, 3B + 4 = 3F,
3F + 1 = 40, 40 + 7 = 47,
47 + 8 = 4F, 4F + 1 = 50,
50 + F = 5F, 5F + 1 = 60,
60 + 8 = 68, 68 + 4 = 6C,
6C + 4 = 70, 70 + E = 7E,
7E + 3 = 81, 81 + F = 90,
90 + 2 = 92, 92 + 1 = 93,
93 + C = 9F, 9F + 1 = A0,
A0 +10 = B0, B0 + 1BCB.

Here are some more examples:

CB +23 = EE, EE + E = FC,
FC + 3 = FF, FF + 1 = 100,
100F = 10F, 10F + 31 = 140,
140A = 14A, 14A + F = 159
1593 = 15C, 15C + F = 16B,
16B1 = 16C, 16C + F = 17B

[#decrbin]: Counting down in binary

When one is subtracted from a digit which is at the lowest value, a zero, then two things happen. First, that digit gets set to the greatest possible value, which in binary is a one (and in decimal is a nine and in hexadecimal is an F). The second step is that the next-least-significant digit is reduced by one. This whole concept is called “borrowing”. The concept of “borrowing” is discussed only very briefly here, because of the assumption that such a concept is familiar (from subtracting decimal numbers).

Naturally, if (in binary) 111 + 1 = 1000, then one would expect that 1000 - 1 would result in the original number, 1111. That way subtraction and addition have their appropriate behaviors when moving back and forth bewteen similar numbers. That's exactly what happens. The least significant digit (on the far right) becomes a the greatest value, which is a one (in binary), so the number temporarily looks like 1001 but the subtraction is not complete until we also subtract one from the second-least significant digit. Since that is also a zero, the process repeats, until the end result is a number that looks like 0111. Then, in many cases it is appropriate to drop any leading zeros, so the result looks like 111.

(Non-)impact of which base gets used

Addition, subtraction, multiplication, and division work the same no matter what base is used.

Comparing how a number operates to a physical object's operations

These different bases are like languages. An object made of wood and four legs might be called a “desk” (or perhaps a “table”) by a person who speaks English. Someone speaking French (or referring to the USA's FBI) might use the word “bureau”. The Dutch would use the word “lessenaar”. In Polish, the word is “biurko”. In Swahili it is called “dawati”, and in Swedish this is called a “skrivbord”.

Regardless of whether I refer to an item as a desk or a bureau or a “SopDaq”, the basic concept remains the same: some legs or sides that prop a flat top off of the ground. If I start speaking in Dutch and later switch to Swahili, that doesn't change what a desk is. How I write the word doesn't change the basic characteristics of a desk. The concept of a desk remains the same no matter which languages may get used.

Example: 4+2

Similarly, numeric value isn't tied to a specific way of writing the numbers. Consider the following:

• 4 + 2 = 6
• four plus two equals six
• IV + II = VI
• cuatro y dos son sies
• quatre et deux font six
• vier und ein Paar macht sechs
• a third of a dozen, plus a sixth of a dozen, makes half a dozen

Whether communicating in Arabic numerals, English words, Roman numerals, Spanish, French, German, or any other language, people expect the mathematical arithmetic operations to work identically. The concepts behind the numbers operate the same way, regardless of what language is used. Four plus two is six, no matter what language is working with.

If I go to a nation that speaks a foreign language, and I give the merchant 8 shekels to purchase something that only costs 3 shekels, then I hope I will be given 5 shekels back in change. If not, then I'm getting ripped off. This is true regardless of what languages I know, or what language the merchant speaks. We might not even speak the same language. Since I'm in a foreign nation, I may not even know how much a shekel is worth. However, what I do know is that if I have eight and need to pay three, then I should be getting five back. Otherwise, if I get less shekels back, then I'm getting ripped off!

So, binary math works the same way as decimal math. In theory, this should mean that the number four in binary, added to the number two in binary, should equal the number six when written in binary. Is that true? Take a look:

As can be seen in the hexadecimal chart (see hex values), the value of four is 100 and the value of two is 10. When we add them, the result is 110.

Adding: Four Plus Two (in Binary)
Step One Step Two Step Three Step Four
 100 + 10 ====
 100 + 10 ===⇓    0
 100 + 10 ==⇓=   10
 100 +⇓10 =⇓==  110

So, we end up with a value of 110. (Visually, the math there looks correct regardless of whether binary, decimal, or hexadecimal gets used.) Checking the binary chart will confirm that 110 is, indeed, equal to six.

As can be seen in the hexadecimal chart (see hex values), the value of four is 100 and the value of two is 10. When we add them, the result is 110.

Length

In Hexadecimal, there are six more digits, so counting from 20 to 30 requires counting through another six digits. However, we have more than just 60% more numbers available with each hexadecimal digit, because after 9F we also have A0 through FF to need to count through. The result is that the third digit isn't needed until 256 (which is 100 * 1.6 * 1.6).

Reviewing the binary/decimal/hexadecimal chart, binary requires a third digit just to count up to four. With decimal, a second digit isn't needed until counting up to ten, and a third digit won't be needed until one hundred is reached. With hexadecimal, the second digit isn't needed until counting up to sixteen, and a third digit doesn't get needed until counting past two hundred fifty five. By that time, binary counting will require ten digits.

What becomes clear (by looking at the binary/decimal/hexadecimal chart) is that when there are fewer possible values for each “place”/“column” (e.g. binary), then the number of required digits is left equal or is increased. When there are more possible values for each “place”/“column”, then the total number of digits is equal or lessened.

Some examples of hexadecimal digits being used include 128-bit IPv6 addresses, 48-bit MAC-48 addresses, and digital certificate's fingerprint. In each of these cases, typing the number can be a bit tedious. Typing such numbers would just be even more tedious (more often) if smaller bases were used, because then more digits would need to be typed (if the number was ever typed). However, saving typing isn't the only reason to use a large base. (SSH keys are not typically typed by hand, but they do typically use a larger base.) The other nice thing is that the numbers can be displayed in a more condensed-looking format.

The possible values of a common octet (8-bit) byte is 256 different values. Unlike base 256 (or most bases higher than 64), typing hexadecimal digits is typically easy on a standard keyboard. Unlike smaller bases, such as base 10, all of those possible values can be represented using just two digits when using hexadecimal digits. This has made hexadecimal representation quite nice when viewing binary data, such as can be seen by some “binary”/“hex” file editors. (These file editors, which support a mode for editing “binary” files that are not standard text files, have used hexadecimal displays so much that they have even become known as “hex” editors.) Viewing files may also have a similar layout, as seen by JP Software's `list` command (by pressing `x` when viewing a file).

Other qualities
Leading zeros

A leading zero has no impact. So, as an example, the charts at hex values, which has no leading zeros, and the chart that does show leading zeros for the binary numbers (in the section about powers of two), have no real mathematical difference.

Number of digits in a product

Some people know the generally useless trivial fact that a thousand (1,000) times a thousand (1,000) is a million. Less well known is that (in decimal) 999 x 999 = 998,001. (That resulting number is equal to 999,999 - 999 - 999.) Considering that 1,000x1,000=1 million, it does make sense that multiplying a number that is slightly under a thousand, times another number that is slightly under a thousand, will give a result that is a little bit under a million.

In hexadecimal, FFF x FFF = FFE001.

There is a little-known rule in mathematics that says that multiplying two numbers will result in a number that does not have more digits than the numbers multiplied. So, multiplying a twelve digit number by an eight digit number will result in a number that is no more than twenty digits long.

This rule holds true for hexadecimal just like it does with decimal.

When to use another place

Binary: a third digit is needed for the number four. That is two raised to the second power. Decimal: a third digit is needed for the number one hundred. That is ten raised to the second power. Hexadecimal: a third digit is needed for the number 256 (which comes right after 255, which is FF). The number 256 is 16 raised to the second power. So in each case, the digit is needed after a number which is a power of the base being used.

Every time a new digit is needed, it will be for a number which is a power of the base being used.

So, there are some differences between the bases. (For binary, this happens at two raised to a power, while in hexadecimal this happens when sixteen gets raised to a power.) On the surface, this might seem to violate the observation that the different bases operate the same. However, what is being discussed here is really more about how the numbers get written. That's a bit of a different topic than the mathematical value behind each number. And there's no doubt that the way a hexadecimal number gets written may look different than if that number was written out in binary. However, even for this rule, there is still yet a discernable pattern that is consistent between all of the different bases.