Hexadecimal
Introduction
Have you ever felt constrained forming numbers with just 10 numerical digits? Or wanted to represent large numbers with fewer digits? Or easily identify byte values without having to look at binary's hypnotic string of 1's and 0's? For applications like these, hexadecimal often becomes the engineer's number-system-of-choice.
Hexadecimal -- also known as hex or base 16 -- is a system we can use to write and share numerical values. In that way it's no different than the most famous of numeral systems (the one we use every day): decimal. Decimal is a base 10 number system (perfect for beings with 10 fingers), and it uses a collection of 10 unique digits, which can be combined to positionally represent numbers.
Hex, like decimal, combines a set of digits to create large numbers. It just so happens that hex uses a set of 16 unique digits. Hex uses the standard 0-9, but it also incorporates six digits you wouldn't usually expect to see creating numbers: A, B, C, D, E, and F.
There are many (infinite!) other numeral systems out there. Binary (base 2) is also popular in the engineering world, because it's the language of computers. The base 2, binary, system uses just two digit values (0 and 1) to represent numbers.
Hex, along with decimal and binary, is one of the most commonly encountered numeral systems in the world of electronics and programming. It's important to understand how hex works, because, in many cases, it makes more sense to represent a number in base 16 than with binary or decimal.
Covered in This Tutorial
This tutorial covers everything hex-related that you might encounter in electronics or programming. It's split into the following sections:
- Hex Basics -- An overview of hex. This page covers the 16 digits of hex, how we represent hex numbers, and how to count in hex.
- Converting To/From Decimal -- This page covers our preferred methods of converting between hex and decimal.
- Converting To/From Binary -- This page shows how you can convert between binary and hex.
- Conversion Calculators -- Here you'll find a simple, automatic calculator to switch between hex, binary, and decimal.
Suggested Reading
You should know a thing or two about decimal numbers before delving into this tutorial. Remember long division? Remainders? Quotients? Products? Sums? Exponents? Those all come back to haunt you when you're learning about hexadecimal and its relationship to decimal.
Beyond brushing up on your arithmetic, we'd recommend reading through our binary tutorial before (or along-side) this.