RGB and HEX colours (2024)

You’re probably aware that when it comes to computers, colours are represented by a series of numbers. In this post, John Espirian explains two of the most common colour systems used on the web.


RGB and HEX colours (1)

RGB and HEX are colour systems used on the web

There are lots of colour systems available, but the two mentioned here use the additive colour system. This means they are based on the combination of light, with the primary colours being red, green and blue. In the additive system, red, green and blue together produce white.

RGB maths

red + green + blue = white

For comparison, paints, dyes and inks use the subtractive colour system.

RGB and HEX colours (2)

Sticking with the idea of light, imagine that the red, green and blue components are coloured torches pointing at the same spot. But these torches are special: instead of being either on or off, they can be partially on. Consider that the torches have analogue dials rather than on/off buttons.

With this idea in mind, we can move straight on to the two most popular colour systems on the web.

Think of red, green and blue light as special coloured torches

If you already know about RGB colours, take a look at this very useful resource for looking up colour values: rgb.to

RGB colours

Each of the RGB (red, green, blue) system’s three torches has a setting between 0 and 255.

A value of 0 means the torch is off.

A value of 255 means the torch is on and shining at its maximum.

If all the torches are off, there’s no colour at all. This is black:

  • R: 0
  • G: 0
  • B: 0

If all the torches are on and at their maximum, we instead see white:

  • R: 255
  • G: 255
  • B: 255

To save space, we’ll use shorthand to represent some further examples:

To produce other colours, we just need to use different combinations of values. If you’re not used to additive colour, the results might sometimes seem a little counterintuitive. For example, yellow is red plus green: RGB(255, 255, 0).

More RGB maths

red + green = yellow

A visual example should be helpful:

RGB and HEX colours (3)

The additive colours of RGB

The above examples show our torches either off (0) or on at maximum (255). But any whole number in between these values is also valid. So we could have, say, RGB(213, 82, 7), which has a large red value and smaller green and blue values. This colour looks orange.

HEX colours

HEX colours are exactly the same as RGB, but they’re expressed using hexadecimal (base 16) numbers instead of the decimal (base 10) system we’re more used to.

If you haven’t seen the hexadecimal system of counting before, it boils down to each column of numbers accepting more than 10 possible figures. Instead, we can represent up to 16 figures per column – and that’s done by using some letters as well as our usual numbers.

Here’s how this looks for the 16 numbers between 0 and 15.

Decimal 0 1 2 3 4 5 6 7 8 9101112131415
Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F

If we consider two-digit numbers, base 10 uses a ‘tens’ column and base 16 a ‘sixteens’ column. This means that RGB values can be expressed in fewer characters by using HEX. Here are some examples:

  • FF = (16 × 15) + 15 = 255
  • F0 = (16 × 15) + 0 = 240
  • AB = (16 × 10) + 11 = 171
  • 86 = (16 × 8) + 6 = 134

Getting back to colours, we can represent the previous examples as follows:

Note that in HEX colour notation, we start the sequence of characters with the hash (#) symbol.

As you might be able to tell, the first two characters represent the red, the middle two characters the green, and the final two the blue.

To give one further example, our earlier code RGB(213, 82, 7) can be written in HEX as #D55207. Here it is:

RGB and HEX colours (4)

An easy way to look up RGB and HEX colours

Keeping these conventions in mind isn’t always easy. Here’s an excellent resource for looking up RGB and HEX colours:

RGB and HEX colour website

https://rgb.to – look up RGB and HEX values

The website also includes details about Pantone and other colour systems.

If you click on any of the colour codes listed above, you’ll be taken to the relevant page on https://rgb.to – neat, eh?

Here’s another good colour resource:

Adobe Color CC (formerly Adobe Kuler)

https://color.adobe.com – a colour wheel for RGB and HEX

How many colours are there in the RGB and HEX systems?

Each torch’s value must be between 0 and 255, which means 256 possible values. We have 3 torches and must multiply the figures to work out how many possible colours there could be in these systems:

256 × 256 × 256 = 16,777,216

That’s more than 16.7 million colours.

Let’s wrap up

There’s a lot more that could be written about colour, but these basics should help you understand enough about two of the most popular colour systems used on the web.

RGB and HEX colours (2024)
Top Articles
Ralphs digital coupons in AZ
EVANGELIST EBUKA OBI'S CATHOLIC IDENTITY: A REBUFF - Witnessline
Will Byers X Male Reader
Food King El Paso Ads
Craigslist Monterrey Ca
Shoe Game Lit Svg
El Paso Pet Craigslist
Botw Royal Guard
Cash4Life Maryland Winning Numbers
Osrs But Damage
1TamilMV.prof: Exploring the latest in Tamil entertainment - Ninewall
Dark Souls 2 Soft Cap
Hover Racer Drive Watchdocumentaries
Mycarolinas Login
Summoners War Update Notes
Morgan And Nay Funeral Home Obituaries
Wizard Build Season 28
Price Of Gas At Sam's
Truth Of God Schedule 2023
Billionaire Ken Griffin Doesn’t Like His Portrayal In GameStop Movie ‘Dumb Money,’ So He’s Throwing A Tantrum: Report
Craigslist Pinellas County Rentals
Earl David Worden Military Service
Georgetown 10 Day Weather
Used Safari Condo Alto R1723 For Sale
Sunset Time November 5 2022
Craigslist Battle Ground Washington
Weldmotor Vehicle.com
Orange Park Dog Racing Results
Duke University Transcript Request
Osrs Important Letter
Dl.high Stakes Sweeps Download
Lincoln Financial Field, section 110, row 4, home of Philadelphia Eagles, Temple Owls, page 1
Ff14 Laws Order
Haunted Mansion Showtimes Near Cinemark Tinseltown Usa And Imax
Crystal Mcbooty
Keeper Of The Lost Cities Series - Shannon Messenger
Body Surface Area (BSA) Calculator
The Best Restaurants in Dublin - The MICHELIN Guide
Empires And Puzzles Dark Chest
Craigslist Pets Plattsburgh Ny
Callie Gullickson Eye Patches
Exam With A Social Studies Section Crossword
Top 1,000 Girl Names for Your Baby Girl in 2024 | Pampers
The Nikki Catsouras death - HERE the incredible photos | Horror Galore
Craigslist Chautauqua Ny
Canonnier Beachcomber Golf Resort & Spa (Pointe aux Canonniers): Alle Infos zum Hotel
Arginina - co to jest, właściwości, zastosowanie oraz przeciwwskazania
De boeken van Val McDermid op volgorde
Motorcycle For Sale In Deep East Texas By Owner
2000 Fortnite Symbols
Provincial Freeman (Toronto and Chatham, ON: Mary Ann Shadd Cary (October 9, 1823 – June 5, 1893)), November 3, 1855, p. 1
Affidea ExpressCare - Affidea Ireland
Latest Posts
Article information

Author: Nathanial Hackett

Last Updated:

Views: 6201

Rating: 4.1 / 5 (52 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Nathanial Hackett

Birthday: 1997-10-09

Address: Apt. 935 264 Abshire Canyon, South Nerissachester, NM 01800

Phone: +9752624861224

Job: Forward Technology Assistant

Hobby: Listening to music, Shopping, Vacation, Baton twirling, Flower arranging, Blacksmithing, Do it yourself

Introduction: My name is Nathanial Hackett, I am a lovely, curious, smiling, lively, thoughtful, courageous, lively person who loves writing and wants to share my knowledge and understanding with you.