If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

# Hexadecimal number system

## Video transcript

we're all familiar with the base 10 number system or often called the decimal number system where we have 10 where we have 10 digits 0 1 2 3 4 5 6 7 8 9 and now we've started to see that we can have alternate number systems we can have a base 2 number system known as the binary number system where instead of 10 digits you only have 2 digits and each place instead of being a power of 10 is going to be a power of 2 now you can imagine that we can keep extending this we can extend to base 3 4 5 6 7 8 9 or we could even go above 10 and what I want to expose you what I want to show you in this video is a fairly heavily used number system that is larger than or that has more digits than base 10 and that is base 16 base 16 often called the hexadecimal hexa decimal number system and as you can imagine instead of having only nine instead of only having 10 digits it is going to have 16 so what are those digits going to be and as we'll see instead of the places being powers of 2 or powers of 10 they're going to be powers of 16 so let's see we could reuse the existing 10 digits from the hexade from the decimal number system so we can reuse 0 1 2 3 4 5 6 7 8 9 but then we're going to need to have 6 more digits and so the convention is to use the the first six letters a b c d e and f you might say these crazy these are these are letters not numbers but remember these are just arbitrary squiggles of ink on a piece of paper these are just arbitrary symbols that we've grown to associate with things so you've grown to associate this symbol right over here with a t' thing with the nut with the word 8 which you associate with when you see that many objects and so if you're thinking in hexadecimal this isn't the letter A that makes you want to say ah or the letter B that makes you want to say buh buh buh buh buh this is literally this represents if you had ten things laying around you would say I have a things over there if you had eleven you'd say I have B things over there twelve see things thirteen step saying I've thirteen you get to AB D things there and instead of saying I have fourteen you could say I can I have a things there instead of saying I have fifteen you could say I have F things there now how does that help well let's see if we can represent the same number 231 or 231 in decimal if we can represent that same number in hexadecimal and I'll what I'll do is I'll give you what the number is and then I'll show you how we convert it I'll show you the place value and I'll show you how we convert it so 231 in hexadecimal 231 and hexadecimal is the number e e7e seven and once again you're like this looks crazy this looks like I'm playing like battleship or something what's ee7 this is a number and I would say yes this is a number now you remember base 16 what are these place values represent this first place represents 16 to the 0 power or still represents the ones place this is the ones place this is seven ones now what is this place here represent well in base ten that was 10 to the first power and base two those two to the first power so in base 16 this is going to be I'll leave those there in base 16 this is going to be 16 to the first power so this is little release I'll write well let me write out the word this is literally 16s so this is e 16 s plus seven ones and so let me write that down this is e 16 s e 16 s 16 s plus seven ones that's what this number represents now if we want to start rewriting this we re conceptualizing it in our decimal number system what is e 16 s well the e if we think in decimal he is he is 14 e is e is 14 and so this is really you could really think of this if you wanted in to think in decibels this is 1416 s so what's 14 16s well that's just the same thing as 14 times 16 14 times 16 is equal to 224 let me actually do that same color so this thing is going to be this right over here is going to be 224 14 16 14 times 16 is 224 plus seven ones plus seven ones well 224 plus seven is going to give you 231 so hopefully you can appreciate you can represent the same quantity in any different in any of these different number systems and any number that you can represent in decimal you can also represent that number in binary or in hexadecimal or in base 3 or in base 60 or in base 31 whatever you want to do and you might have noticed a pattern the more symbols that we have so in base 16 you have 16 symbols the less place values we need to represent the same quantity and one way to think about it is each of the places are containing more information this is one of 16 characters while this over here is only one of two characters this is one of 10 characters so the more symbols that you have the more digits that you you could put in each place the less places that you need to represent to represent a given quantity another way to think about it is when you have a high base like base 16 as you take powers of 16 what's the you know the next place right over here would be 16 would be 16 squared which of course is 200 and will be 256 you're clearly going to be able to represent bigger numbers faster I guess you could say or with less digits so it's just an interesting thing to observe but hopefully you're you get a kick out of as much of a kick out of base 16 as I do and it's actually useful this actually is used if you look at most web pages and if you look at the actual code for the or I guess you could say the format or the the formatting like the HTML for the web page when they specify colors they tend to specify it in hexadecimal and that's because you're specifying the colors the intensity of the red the green or the blue between 0 and 255 and so two digits of hexadecimal are perfect for that because if you think about it what is what is F what is F F what would this be if you were to rewrite it in the decimal number system and I encourage you to put too well after this video is done I encourage you to do that to figure that out on your own and if you really want to do something fun let me give you another one try to figure out what a f3 is and a this isn't anything special I just wanted to give you another interesting thing to work on