!(https://hackernoon.com/hn-images/1*hQuN9CAthEYjFFeqOoi2tg.jpeg)\n\nWe have all seen them before, they look a bit like this: **#ff0000**. That’s the hex code for the color red. However, what exactly does it mean?\n\n### Hexadecimal\n\nMost of us have heard of binary before, but what about hexadecimal? Hexadecimal, sometimes known as ‘hex’ or ‘base 16’ is an alternative to binary, which is ‘base 2’. Hexadecimal can be used to store numbers. So how does it work?\n\n#### The Basics\n\nThere are 16 possible characters in hexadecimal, they include 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F. Each character represents an integer from zero to fifteen.\n\nNow that we know what each of the characters mean, let’s start converting integers into hexadecimal. So let’s convert the number 2,087 into hexadecimal.\n\n#### Some Examples\n\nLet’s first start off by dividing 2,087 by 16. That should get us a result of 130 with a remainder of 7. According to our chart from above, 7 is also **_‘7’_** in hexadecimal, so now we need to set **_‘7’_** aside and divide 130 by 16. Our answer is 8 with a remainder of 2. On our chart, 2 is **_‘2’_**, so set that to the side and we need to divide 8 by 16. This will get us 0 with a remainder of 8, which translate to **_‘8’_** in hex. So we have our 3 results which are 7, 2 and 8. We will put them together in reverse order to get our hexadecimal value which means that 2,087 is **_‘0x827’_**. 0x is there to symbolize that it is a hex value.\n\nLet’s try another, this time we will try the number 255. First we need to divide 255 by 16. That will get us 15 with a remainder of 15. Now we take the remainder and line it up to our chart. 15 translate to **_‘F’_**, so we can save **_‘F’_** for later. Now we need to divide 15 by 16, which will get us 0 with a remainder of 15. We know that 15 translates to **_‘F’_**, which makes our result **_‘0xFF’_**.\n\n### Color Codes\n\nHex color codes usually look something like this: **#ff0000**, but what does this mean? Well, let’s break it down!\n\n#### RGB\n\nRGB stands for Red, Green, and Blue. These colors are the primary colors of light. An RBG value might look like this: **rgb(255, 0, 0)**. At first this may not look like much, but if we take a closer look, the first number represents red, second number represents green, and the third number represents blue. The values in those spots can range anywhere from 0, all the way up to 255. Let’s try to make some colors!\n\nWith light, red and blue makes magenta, so let’s try to make a magenta color with RGB. So to get a bright magenta color, let’s set both blue and red to their maximum value of 255. So we have: **rgb(255, 0, 255)**, which gives us a color like this:\n\n!(https://hackernoon.com/hn-images/1*lO4r5NoY-o3XfPHLAjKChg.png)\n\nrgb(255, 0, 255)\n\nBut what if we wanted it to be a bit lighter, like a more pinkish color? How do we do that? White in RBG is **rgb(255, 255, 255)**, all the colors combined. So how about we try changing **rgb(255, 0, 255)** to **rgb(255, 150, 255)**? We get the result of a light pink.\n\n!(https://hackernoon.com/hn-images/1*uGnQE0pxkZj8uCqfjM1wcQ.png)\n\nrgb(255, 150, 255)\n\nSo how about a darker color? So we can have a dark pink? In RGB, black is **rgb(0, 0, 0)**, so let’s bring our values closer to that. So let’s try **rgb(150, 0, 150)**. With that, I got this:\n\n!(https://hackernoon.com/hn-images/1*mFhObLOzznvl88DiRWVVCg.png)\n\nrgb(150, 0, 150)\n\n#### Hex Colors\n\nNow that we have a good understanding of RGB, we can understand how hex colors work. A hex color will look something like this, **#ff0000**. But what does this mean? Let’s combine what we know about RBG and Hexadecimal to figure it out. We know that 0xFF is 255 in hexadecimal, and 255 is the maximum value for RGB. If we see what #ff0000 is, we can see that it is a bright red color:\n\n!(https://hackernoon.com/hn-images/1*r5x7-J4EJ6KWca10ufkhrA.png)\n\n#ff0000\n\nWhat we can find out is that **#ff0000** translate to **rgb(255, 0, 0)**. Let’s try to get our magenta color again, we know that it is **rgb(255, 0, 255)**, so let’s see what **#ff00ff** gets us.\n\n!(https://hackernoon.com/hn-images/1*lO4r5NoY-o3XfPHLAjKChg.png)\n\n#ff00ff\n\nAwesome! We got our magenta color, now let’s try to get our lighter color again, but this time in hex. Our light magenta in RGB is rgb(255, 150, 255), so if we convert 150 into hex, 150 divided by 16 is 9 with a remainder of 6. 9 divided by 16 is 0 with a remainder of 9, making our hexadecimal value **_‘0x96’_**. The result is our hex color of #ff96ff, and when we see the result of that, we get our light magenta.\n\n!(https://hackernoon.com/hn-images/1*uGnQE0pxkZj8uCqfjM1wcQ.png)\n\n#ff96ff\n\n### Conclusion\n\nAfter reading this, you are able to understand how the hex colors work, how the first two characters are for the red, the next two for green, and the next two for blue for RGB colors. I hope this article taught you something new, whether it be hex colors, RGB, or base16.\n\nIf you enjoyed this article, please follow me on other platforms of social media below:\n\n[**Danny Tran (@hoogleyb) \\* Instagram photos and videos** \n_335 Followers, 115 Following, 116 Posts - See Instagram photos and videos from Danny Tran (@hoogleyb)_www.instagram.com](https://www.instagram.com/hoogleyb/ "https://www.instagram.com/hoogleyb/")(https://www.instagram.com/hoogleyb/)\n\n[**Danny Tran (@HoogleyB) | Twitter** \n_The latest Tweets from Danny Tran (@HoogleyB). I'm proud to say I'm a senior web developer, but I'm more proud to say…_twitter.com](https://twitter.com/hoogleyb "https://twitter.com/hoogleyb")(https://twitter.com/hoogleyb)\n\nIf you find there is anything wrong with the article, mention it below in the comments and I’ll fix it!\n\nHappy Coding!