HEX, RGB and HSL Color Codes Explained for Beginners
Whether you're designing a poster in Canva, styling a website with CSS, or matching your small business's brand colors, you'll see codes like #2563EB, rgb(37, 99, 235) or hsl(221, 83%, 53%). They can all describe the exact same blue. Here's what each format means and when to use it.
How screens make color
Every pixel on your screen mixes three lights: red, green and blue. By changing the brightness of each one, a screen can display millions of colors. All three color code formats are just different ways of describing that mix.
RGB
RGB lists the amount of red, green and blue, each from 0 (none) to 255 (full).
rgb(255, 0, 0)is pure red.rgb(0, 0, 0)is black (no light).rgb(255, 255, 255)is white (all lights at full).
RGB is easy to understand once you think of it as mixing light rather than paint.
HEX
HEX is RGB written in hexadecimal (base 16), the most common format in web design and design apps. A HEX code has six digits after #: two each for red, green and blue.
#2563EB → red 25, green 63, blue EB (hex) → rgb(37, 99, 235)
Hex digits go from 0–9 and then A–F (A=10 … F=15), so FF = 255 and 00 = 0. Short forms like #FFF mean #FFFFFF.
HSL
HSL describes color the way people think about it:
- Hue (0–360°): the position on the color wheel. 0 is red, 120 is green, 240 is blue.
- Saturation (0–100%): how vivid the color is. 0% is gray.
- Lightness (0–100%): 0% is black, 50% is the pure color, 100% is white.
HSL is the easiest format for creating variations: keep the same hue and saturation, then change the lightness to make lighter tints and darker shades of your brand color for backgrounds, borders and hover effects.
Converting between formats
Use our Color Picker & Converter: pick or enter a color and copy its HEX, RGB and HSL codes in one click. This is handy when one app gives you a HEX code and another asks for RGB.
What about CMYK?
Printers use CMYK (cyan, magenta, yellow, black) ink instead of light. Colors that look bright on screen may print duller. If you're printing tarpaulins, flyers or business cards, ask your printer whether they need CMYK files, and print a test copy first.
Choosing readable colors
- Contrast matters most. Dark text on a light background (or the reverse) is easiest to read. Avoid light gray text on white, or red text on green.
- Limit your palette. Use one main brand color, one accent color, and neutral grays.
- Think about color blindness. Don't rely on color alone to show meaning. Add icons or labels too.
- Stay consistent. Save your brand's exact HEX codes and use them everywhere: website, social media posts and printed materials.
Example: building a simple palette
Start with a brand blue, hsl(221, 83%, 53%). For a light background, raise the lightness to 95%: hsl(221, 83%, 95%). For a dark hover state, lower it to 40%: hsl(221, 83%, 40%). All three clearly belong together because they share the same hue.
More guides
- How to Compute 13th Month Pay in the Philippines (With Examples)
- SSS, PhilHealth and Pag-IBIG Contributions 2026: A Simple Guide
- How to Compute Your Take-Home Pay in the Philippines
- How to Merge PDF Files on Your Phone or Computer (Free)
- How to Convert Word to PDF (Word, Google Docs, WPS and Phone)
- How to Scan Documents to PDF Using Your Phone Camera
- How to Create a Strong Password You Can Actually Remember
- How to Make a QR Code for Your Small Business
- How Many Pages Is 500 Words? Word Count Guide for Essays
- How to Compute Discounts, VAT and Percentages (Philippines)
- Add-On Rate vs. Diminishing Balance: Understanding Loan Interest
- Overtime, Rest Day and Holiday Pay in the Philippines: How to Compute
- Final Pay (Back Pay) in the Philippines: What's Included and When You'll Get It
- BIR Form 2316 Explained: What It Is and Why You Need It
- Pag-IBIG MP2 Savings: How It Works and How Much You Can Earn
- How to Compute Your Daily and Hourly Rate from Your Monthly Salary