How to Convert Decimal to Hexadecimal: Fun & Easy Guide for Beginners

Want to master decimal-to-hexadecimal conversion? Join me in this fun, beginner-friendly tutorial where we break it down with clear examples?like turning 223 into 0xDF! From number systems to handy calculator tricks, I?ll guide you step-by-step, no stress. Bonus: my dog makes a cameo! Perfect for coding newbies or anyone curious about hex. Subscribe for more easy tech tutorials, and let me know what you want to learn next! #DecimalToHex #CodingBasics #LearnToCode

Introduction 00:00:00
Number Systems Overview 00:00:12
Decimal vs. Hexadecimal 00:00:39
Hexadecimal Digits Explained 00:01:06
Conversion Process Introduction 00:01:40
First Conversion Example Start 00:02:10
Handling Remainders 00:02:38
Dog Interruption 00:03:16
Continuing First Conversion 00:03:43
Finalizing First Conversion 00:06:04
Reversing Digits Order 00:06:24
Mapping Numbers to Hex Letters 00:07:34
Verifying First Conversion 00:08:48
Hexadecimal Prefix Importance 00:10:57
Second Conversion Example (223) 00:11:34
Third Conversion Example (2816) 00:13:32
Hex and Binary Relationship 00:14:56
Padding Zeros in Hex 00:16:07
Video Conclusion 00:16:58

Thanks for watching!

Find us on other social media here:

  • https://www.NeuralLantern.com/social

Please help support us!

  • Subscribing + Sharing on Social Media
  • Leaving a comment or suggestion
  • Subscribing to our Blog
  • Watching the main “pinned” video of this channel for offers and extras

Hello there.

Let’s talk about converting decimal to hexadecimal.

Hopefully you’ve watched my other videos by now, but basically we have different number

systems, number bases that we can use.

We have decimal, which is a base 10.

which is base 10 or sorry base 16.

We can basically convert back and forth between all of these systems.

We can represent the exact same number just in different ways.

Just as a quick refresher.

Decimal, we can have characters that are 0 through 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.

That’s 10 total characters.

That’s why it’s base 10.

In binary, we have, you know, just characters 0 and 1.

characters 0 and 1 and in hexadecimal it’s meant to compact the representation a little bit it has

more characters or more possible characters per digit than decimal so the number is going to be

a little bit shorter usually unless it’s like very very small than decimal and it’ll be a lot shorter

than the same number in binary so in hexadecimal we start off with 0 1 2 3 4 5 6 7 8 9

three, four, five, six, seven, eight, nine.

And then to get the remaining digits, we just go A, B, C, D, E, F.

So we have this many characters.

It’s 16 total characters.

We can represent a number between 0 and 15.

So that’s a difference between, you know, hexadecimal and decimal.

Now let’s learn how to actually convert.

So I’m going to start off with a number.

I’m just going to type like a random number here.

Hopefully this doesn’t go on for too long, the conversion.

decimal number is just that. How do we convert? If you watch my other videos, it’s basically the

same thing as converting from decimal to binary, except instead of dividing by two, because binary

is base two, we’ll divide by 16 because hex is base 16. So I’m going to start off by saying,

let’s take the original number and we’ll divide it by not two, 16. What does that equal? There’s

no way I’m doing this in my head. So I’m just going to use a calculator for every single step,

going to use a calculator for every single step not even going to try I’m

going to say this number divided by 16 is 5 1 1 7 5 7 with some sort of a

remainder so I’m gonna go 5 1 1 7 5 7 remainder something so in most

calculators you can just punch up the modulo operator which is like the

percent symbol before I do that I just want to point out 0.75 is 3 4ths of

of whatever it is that is one you know that one character can represent we know

we can represent 16 different values what’s 16 divided by 4 that’s 4 so three

of those should be like 12 I hope unless I’m saying something totally wrong so

I’m gonna do modulo so that’s 12 okay remainder 12 my dog is growling at me

He likes to lie about peeing.

He doesn’t actually pee.

He already did a huge pee and then three times after that at 20 minute intervals, he went

out there and lifted his leg and just like three squirts came out and he expected a giant

treat for it.

I’m not doing it.

You’re not getting that treat.

I expect a big pee pee if you want a treat.

You dog?

Dang little dog.

Okay.

So, here we are still dividing.

here we are still dividing. I got the remainder. So then we just need to take, you know, the

quotient result, you know, what is the result of actually dividing, just carry it over to

the next line. I’m going to do some spaces to make it look all even and continue to divide.

So divided by 16 equals something. Don’t forget that if you have the modulo operator over there,

you got to take it out, go back to division. It’s going to be 31984 remainder something.

what’s the remainder i’m just going to get the modulo i don’t want i don’t want to recall what

0.8125 is i’m sure some of you out there can already do that but it is 13 remainder 13.

um so i’m gonna go 319 divided by 16 31984 divided by 16 so it’s going to be 1 999 okay so carry that

over real fast though divided by 16 equals 1 9 9 remainder something there’s no decimal point at the

There’s no decimal point at the end of that so I can just assume the remainder is going to be zero.

If you want to double check to be sure, which is a good idea, use the modulo operator.

If your calculator doesn’t have modulo, find another calculator or jump into Python or something.

So I’m going to carry over 199 to the next line there.

1, 2, 4, remainder, whatever modulo says, 15.

That’s pretty cool.

All right, then I’m gonna carry it over,

just 1, 2, 4, divided by 16 again.

If you were hoping I’d be able to do it in my head by now,

you were wrong.

1, 2, 4, divided by 16, it’s gonna be 7.75,

so just like seven, remainder something.

What did I say last time for the 3 4ths?

Was that 12?

whoops, I can’t remember anymore.

12, yeah, okay, so remainder 12.

And then we’ll carry it over and we’ll say 7 divided by 16.

So we know that, you know, 16 doesn’t really fit into 7 at all.

So it’s going to be 0 remainder, whatever the number is.

Let’s punch it here just to double check.

We’ll say 7 divided by 16.

You can see that it’s 0.

And then the remainder is going to be 7, just, you know, what the original number was.

number was. So now at this point when the actual you know carry down quotient is

going to be zero then we just have zero divided by 16 equals just zero remainder

zero and it’ll just continue like this forever and ever and ever and ever and

ever. So this is how you know you’re done. Another thing that I mentioned in

other videos is how do we actually know where the zeros belong? I mean if you

read this intuitively from the top to the bottom you might think that you know

you know the top number is going to be like the first digit but it’s actually

backwards it goes from the bottom up the reason you can know that is again based

on my other videos if we just type a random decimal number here if I add

zeros to the right side I’m actually changing the value of the number I’m

making it bigger but if I add zeros to the left side I’m not changing the value

at all so that means those zeros here which could go on for infinity based on

how much tenacity you have they should be on the left side because you don’t

side because you don’t want any amount of these zeros to change the value of your number because

they you know it’s an arbitrary number of zeros based on how how fast you get tired of doing zeros

so that means if i go from top to bottom i have to reverse it if i go from bottom to top it’s

already going to be in the right order or sorry if i if i correlate or if i map bottom to top to mean

left to right then it’s fine already if i map top to bottom for left to right then i’ll have to

For left to right, then I’ll have to reverse it when I’m done.

So I’ll do it both ways just to show you.

But there’s one more step we need to do because in hexadecimal,

we have more characters than decimal.

We have to translate what does this 12 and 13 and these other numbers mean.

Luckily, we had some of them in there.

It could have been too easy.

So remember in hex, we have 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.

And then we have A, B, C, D, E, right?

So we know that the value of 0 is 0 and 1 is 1 and 2 and 2 and so forth, right?

Like 9 is 9.

But what’s the value of A?

For each increasing digit, the value just goes up by 1.

So that means that A is worth 10.

I’m going to write this vertically just so that you understand that this means the strength

of the A is 10.

And then the strength of the B is going to be 11 because it just increases by 1.

The strength of the C is 12.

The strength of the D is 13.

Oops, I forgot the F.

Oops, I forgot the F. Hit F in the chat if you forgot the F too.

So the strength of the E is 14. The strength of the F is 15.

And then we’re done. And remember, there’s 16 digits total.

So the highest value is 15 because it includes the zero.

So, you know, 16 total possible values you could represent, but the highest value, 15.

So that means every time we see a 12 here,

say that that’s really a C and every time we see actually let me let me put

the other C in there real fast every time we see a 13 that means it’s a D

every time we see a zero zero through nine it just it means the original

number oh wow we only had two digits that are gonna mean the original number

so mark my words you know the 15 is gonna be an F every time you see zero

one two three four five six seven eight nine it maps to the same number so seven

maps to seven it’s totally fine the only time it maps to a letter is of course when you exceed nine

so 10 and above are going to map to letters so now i have these mappings i just need to sort of scan

uh my my work to come up with the correct hexadecimal number so i’ll start from top to

bottom because it’s a little bit harder that way and it’ll be more brain practice i’m going to go

and then you know as many zeros as you decided to calculate and hopefully this

reminds you oh no I’m increasing the value by adding the zeros that means I

have to reverse everything so I’m gonna get rid of these zeros though and I’m

gonna reverse it 7cf0dc okay great now let’s double check because it’s always

a great idea to check your work in different ways with different methods to

decrease the possibility that you’re accidentally wrong so now I’m gonna go

So now I’m going to go from bottom to top and see if it’s the same thing.

7 C F 0 D C. Does it match? Yes.

So now I’m pretty confident that I have the right answer.

Let me punch this up in my personal calculator real fast.

I’m going to do just to double check the work before we cut the camera,

because if I’m wrong, I want to be able to correct myself right away.

Instead of coming back with another video later,

which sometimes I guess I’ll have to do.

f0 dc is the correct answer all right so we now have converted our first number from decimal to

hexadecimal nice and by the way if you didn’t already know this you’re supposed to put a

prefix in front of hexadecimal numbers not necessarily in every program that asks for

hex input some of them are not programmed that way but in general when you expect someone to

read your numbers if it’s hex you want to put ox in front of it because you don’t want them to

confuse, let’s say we have this number and this number and this number. All three of those could

be a different number depending on whether they’re binary or decimal or hex. But if you put the

symbols in front, this is binary, this is hex, then now the reader knows that these are three

different numbers and they can infer what the numbers mean. Okay, so let me, let’s just do like

another number. We’ll make it a little bit smaller so it’s easier. We’ll say decimal and we’ll go two,

and we’ll go 2 2 3.

So it’s faster.

So we start off with 2 2 3,

we divide it by 16,

and that’s going to be something.

So 2 2 3 divided by 16

is going to be 13 remainder something.

I’m going to do the modulo operator.

And by the way,

if you don’t have a modulo operator

and you can’t figure out a better way to do this,

a good trick is to just say,

let’s take 13,

because that was the answer, right?

13 point something.

We’ll take 13 and multiply that by 16 again,

that by 16 again so it goes higher then take the difference between that and the original number

so we can say 223 minus uh the number multiplied back up and it’ll tell us that our remainder is 15.

let’s see was that actually the remainder let me just double check here oh gosh what am i doing

223 modulo 16 15 yeah there it is if you’re lazy like me you could also do something like this i

and I don’t have a modulo.

I’ll do 13 times 16 and it’s 208.

And then I’ll just subtract the original number

and then we get negative 15,

but then I know it’s not negative, I know it’s 15.

So it’s just like, it makes you a little bit faster

in the calculator.

So this number I think was too small

because we just do 13 and then divide that by 16.

Obviously the answer is gonna be zero remainder 13.

And we just have a two digit hexadecimal number.

digit hexadecimal number. Let’s do that real fast. What is 15 going to be? It’s A and no, no,

no, not A. Sorry. That’s F. Subtract two from that. D E F. So it’s going to be D, I think.

So then if we go from bottom to top, it’s going to be O X D F. Let me double check that I’m

telling you the right thing. 223 D F. Okay. So we got it right. Let’s do something just like a

not as difficult as the first one so I’ll try four digits maybe two two two two

how about that four digital four digital digits how about that we’ll do

two eight one six divided by 13 equals something two eight one six divided by

16 that’s 176 remainder something there’s no decimal point so I can just

16 is 176 divided by 16 is 11.

Another zero remainder.

Getting kind of boring though, isn’t it?

Remainder zero.

And then we’ll do 11 divided by 16.

That’s going to be zero remainder 11.

That’s too easy.

Okay.

So what is zero?

Zero is zero.

You’re welcome.

And then what is zero?

It’s also zero.

0, it’s also 0 and then what is 11? That’s B.

So we should have a number now of 0xB00 if we’re going from the bottom to the top.

If you go from the top to the bottom of course it’ll be 00B and then you reverse it B00

but I just wanted to skip that step for now.

Let me punch this up into my personal calculator to make sure I don’t need to make a correction.

B00, there we go.

Also, you know, here’s another thing to keep in mind.

it’s to read you know sets of bytes which typically go in patterns of one byte or two

bytes or four bytes or eight bytes or whatever so the cool thing about hex is one character

can represent a number from zero uh to 15 or 16 combinations and if you think about that in binary

that’s four bits right it’s like one two three four one two four eight multiply eight by two

16 subtract 1 is 15.

So you can go from 0 to 15.

So that means for every character in hex,

you get four characters of binary.

So it’s like a huge savings, right?

But the point is, if you wanted to represent one byte,

that’s not going to be four bits.

That’s going to be, you know,

four bits followed by four bits for a total of eight bits.

Even if there are zeros in the beginning,

in binary, if you’re representing a byte,

But in binary, if you’re representing a byte, you typically want to pad the zeros to the

left so that it looks like it’s aligned to nice blocks of eight or 16 or 32 or 64 in

terms of bits.

So we should do the same thing with hex.

We should always have two hex digits together.

We should try not to have like an odd number of hex digits.

And if you want to get more strict than that and say like, oh, only, you know, two or four

eight you can do that but i just will say pad it with a zero to the left remember when you pad a

number with zeros to the left it doesn’t change the value like if i just put a bunch of zeros in

front of this decimal number it wouldn’t change the value so we can do that with hex and it looks

nicer and neater and people can quickly see okay so there’s like a byte right there it’s ob

they can imagine oh that byte is probably um 11. so there’s like a like an 11 byte it’s like got

a sequence of zeros and ones and then there’s another byte right after it which is smaller

which is smaller, which just has zeros.

So it just helps the reader visualize what’s going on.

Okay, I’m going to cut the video here.

I hope you enjoyed this video.

I hope you learned a little bit of stuff and had a little bit of fun.

I’ll see you in the next video.

Hey, everybody.

Thanks for watching this video again from the bottom of my heart.

I really appreciate it.

I do hope you did learn something and have some fun.

If you could do me a please, a small little favor,

please a small little favor could you please subscribe and follow this channel

or these videos or whatever it is you do on the current social media website

that you’re looking at right now it would really mean the world to me and

it’ll help make more videos and grow this community so we’ll be able to do

more videos longer videos better videos or just I’ll be able to keep making

videos in general so please do do me a kindness and and subscribe you know

sometimes I’m sleeping in the middle of the night and I just wake up because I

And I just wake up because I know somebody subscribed or followed.

It just wakes me up and I get filled with joy.

That’s exactly what happens every single time.

So you could do it as a nice favor to me or you could troll me if you want to just wake me up in the middle of the night.

Just subscribe and then I’ll just wake up.

I promise that’s what will happen.

Also, if you look at the middle of the screen right now, you should see a QR code,

which you can scan in order to go to the website, which I think is also named somewhere at the bottom of this video.

where you can just kind of like see all the videos I published and the services

and tutorials and things that I offer and all that good stuff and if you have

a suggestion for clarifications or errata or just future videos that you

want to see please leave a comment or if you just want to say hey what’s up

what’s going on you know just send me a comment whatever I also wake up for

those in the middle of the night I get I wake up in a cold sweat I’m like this

really it really mean the world to me I would really appreciate it so again thank you so much

for watching this video and enjoy the cool music as as I fade into the darkness which is coming for

us all

Thank you.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply