What Are the Differences Between Binary, Decimal and Hexadecimal?

What Are the Differences Between Binary, Decimal and Hexadecimal? Featured Image

You and I grew up counting from one to ten. Computers, however, count a little differently. They use a different numeral system, called binary, to keep track of data. But what’s that mean, and what’s the point of it all?

How Do We Count?

decimal-binary-hexadecimal-counting

All the major number systems in the world are “positional.” This means that the value of a number is determined by where in the number it appears. We call this the “place” value, and it helps determine the magnitude of a number. For example, the decimal system we’re all familiar with uses ones, tens, hundreds and thousands places to indicate how much a single “2” is worth. If “2” is in the hundreds place (as in “200”), its value is higher than the same 2 in the ones place (as in “2”).

It wasn’t always like this, though. This way of representing value is a somewhat modern invention. It requires the use of zero as a placeholder, and zero was only invented about 4000 years ago. That’s why older number systems like Roman numerals and Egyptian hieroglyphics don’t use place. Instead, you add up the value of all the “digits” to arrive at the final value.

Using this basic concept of positional value, we’ve created different numeral systems or ways of writing numbers. Numeral systems are named for the number of increments per place. When we say increments, we mean how many times you can increase the value of a single place before “carrying” that value into the next place. For example, in base-ten we can increment the ones place nine times, with ten different digits (counting zero), before we have to carry its value over to the ones place.

Difference Between Decimal, Binary and Hexadecimal

decimal-binary-hexadecimal-comparison

As a kid, you were taught to count on your fingers. Ten fingers, ten numbers. To count higher than ten you might hold down one finger while counting up on the others. This is the basis of the base-ten, or decimal, number system. It’s the number system that you use every day, and it’s the basis of most folks understanding of the numerical world.

Computers can’t use base-ten, however. The hardware required to represent a base-ten value at the hardware level would be enormously complex. Instead, computers use binary, or base-two, to count. In binary, there are only two numbers: one, and zero. Each “place” also has different values. The lowest place is ones, then twos, fours, eights, sixteens and so on. The value of each place is twice the value of the previous place. To evaluate a binary number’s decimal equivalent, multiply each number by its place value and add all the results together. This is actually the same thing you do when you evaluate a base-ten number, but you do it so quickly you overlook the process.

binary-place-values

Hexadecimal is different from binary and decimal. It uses base-sixteen, meaning that there are sixteen different digits that can appear in a single place. Since we only have ten numerals in our shared language, we use the first six Latin letters (A, B, C, D, E, F) to indicate digits 10 through 15. You might recognize this format from color codes used in web design. When it’s used in computing, it’s often prefixed with 0x to indicate that the following string is to be interpreted as a hexadecimal number. Each place value is sixteen times larger than the previous place value, starting with the ones place.

hexadecimal-place-values

Conclusion: Why Use Different Numeral Systems?

It would certainly be convenient if we could use one numeral system for everything. Unfortunately, each numeral system has its own purpose, so we’re stuck using more than one.

Decimal is the most familiar for human operators, and it’s shared by almost every culture on Earth. That makes it the standard counting scheme for human communication. No surprise there.

Computers can’t count in decimal, however. Their circuits can only represent one of two states: ON or OFF. That makes them a natural fit for binary, which has two states: one and zero. Zero, of course, represents off, while one represents on.

Hexadecimal is more of an edge case. It’s used primarily as a convenient way to represent binary values for human operators. A single place value in hexadecimal represents four bits of memory. That means two places represents eight bits, or one byte. That’s why you’ll see hexadecimal used to represent the value of memory registers. The bit sizing makes it a natural fit, and it’s easier to read than a string of ones and zeros.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Alexander Fox Avatar

Read next

Russia still custom-builds the Soyuz return seats for ISS crew members using plaster casts taken weeks before launch, because astronauts grow as much as five centimetres taller during a long-duration stay and a seat moulded to their Earth-shaped spine would no longer fit the body that comes home
The “CrackBerry” nickname stuck for a reason — and the variable-reward psychology that hooked early-2000s executives on their BlackBerrys is the exact same machinery now running every push notification on every smartphone in your pocket
In 1843, Ada Lovelace described a brass-and-punched-card engine that could act on symbols as well as numbers, even composing music if harmony could be reduced to rules, inside seven translator’s notes three times longer than the paper itself
ARPANET sent its first message on 29 October 1969 from a lab at UCLA to a machine at Stanford, and the message was supposed to read ‘LOGIN’ — but the system crashed after the L and the O, meaning the first word ever transmitted over the network that became the internet was, by accident, ‘LO’.
In 1995, Microsoft shipped a cartoon-house interface called Bob, led by Melinda French, who married Bill Gates while it was in development — it demanded twice the memory of a typical home PC, sold roughly 30,000 copies, and was dead within a year, leaving behind the font Comic Sans and the animated assistant that became Clippy.
The Greenland shark grows about one centimetre a year, does not reach sexual maturity until around age 150, and a specimen carbon-dated by Danish researchers in 2016 was estimated to be at least 272 years old, meaning it was already swimming the North Atlantic when Mozart was composing symphonies.
When Apple shipped iOS 12 in June 2018, a small feature called Screen Time slipped onto every iPhone with a counter nobody had quite prepared for — a tally of pickups — and within a day Tim Cook was telling CNN the number of times he picked up his own phone was simply too many
When NASA lost contact with the IMAGE satellite in 2005, an amateur radio operator in Canada named Scott Tilley picked up its signal in January 2018 while hunting for a classified spy satellite, and the spacecraft turned out to be still spinning, still powered, and still trying to phone home after 13 years of silence.