Color Picker Palette Color Picker Palette
Add to Chrome — Free

Color Picker Palette Blog

Hex vs RGB vs HSL: Color Codes Explained for Beginners

Updated March 2026 · 11 min read

By the ColorPickPro Team  •  March 18, 2026  •  10 min read
Quick Answer: Hex (#f59e0b) is the most common format — use it for CSS and sharing colors. RGB (rgb(245, 158, 11)) is useful when you need to add transparency or do math with color values in JavaScript. HSL (hsl(38, 92%, 50%)) is the best choice when you need to create color variations like tints and shades, because the lightness value is directly adjustable. All three describe the same color — the format just determines what's convenient to work with.
📋 Table of Contents
📋 Table of Contents

When you open a color picker — whether it's in Figma, Chrome DevTools, or a browser extension — you see the same color displayed in three or four different ways simultaneously. A specific shade of amber might show as #f59e0b, rgb(245, 158, 11), and hsl(38, 92%, 50%) all at once.

These aren't different colors. They're different descriptions of the exact same color, using different encoding systems. Each system has strengths and weaknesses depending on what you're trying to do.

This guide explains how each format works, when to use each one, and how to convert between them — without any math-heavy theory.

See All Color Formats Instantly

Color Picker & Palette Manager shows hex, RGB, and HSL together the moment you pick any color — so you always have the format you need.

Add to Chrome — Free


How Color on Screens Works (The One-Minute Foundation)

Every color on a computer screen is produced by combining three channels of light: red, green, and blue. Your monitor has millions of tiny pixels, and each pixel contains three sub-pixels — one for each channel. By varying the intensity of each channel from zero to maximum, any visible color can be produced.

This is why all the common color formats — hex, RGB, and HSL — ultimately encode the same three values. They're just different ways of expressing the same underlying data.

The differences between formats come down to: how readable they are to humans, how easy they are to manipulate programmatically, and which tools expect which format.



Hex Color Codes

Format

#f59e0b

A hex code is a pound sign followed by six characters. Those six characters are actually three pairs: the first pair is red, the second is green, the third is blue. Each pair is a number expressed in base-16 (hexadecimal), where digits go 0-9 and then A-F.

For #f59e0b:

High red, medium green, very little blue = a warm amber-orange color.

Strengths

  • Compact and widely recognized
  • The universal standard for sharing colors
  • Supported everywhere: CSS, HTML attributes, design tools, code editors
  • Easy to copy-paste as a single string

Weaknesses

  • Hard to read intuitively (what does #f59e0b look like?)
  • Hard to create variations without a tool
  • Transparency requires 8-character variant (#rrggbbaa)

Shorthand Hex

When both digits in each pair are identical, you can use a 3-character shorthand. #ffffff becomes #fff, #000000 becomes #000, #ff0000 becomes #f00. This only works when each pair is a double — #f59e0b can't be shortened.

8-Character Hex (with transparency)

Adding two more characters at the end encodes an alpha (transparency) value. #f59e0bff is fully opaque, #f59e0b80 is approximately 50% transparent, #f59e0b00 is fully transparent. This format is supported in CSS and most modern design tools.



RGB Color Codes

Format

rgb(245, 158, 11)

RGB is the same three channels as hex, but expressed in decimal (base-10) instead of hexadecimal. Each channel ranges from 0 to 255. The format is more immediately human-readable: rgb(245, 158, 11) tells you there's a lot of red (245 out of 255), a moderate amount of green (158), and very little blue (11).

Strengths

  • More readable than hex for those who think in decimal
  • Easy to manipulate in JavaScript
  • RGBA adds transparency cleanly
  • Supported in all CSS contexts

Weaknesses

  • Still hard to intuit the color from the numbers
  • Verbose compared to hex
  • Creating variations still requires recalculating all three values

RGBA — Adding Transparency

RGBA adds a fourth value between 0 and 1 for the alpha channel. rgba(245, 158, 11, 1) is fully opaque, rgba(245, 158, 11, 0.5) is 50% transparent, rgba(245, 158, 11, 0) is invisible.

/* Transparent overlay example */ .notification-badge { background: rgba(245, 158, 11, 0.15); /* Very light tinted background */ border: 1px solid rgba(245, 158, 11, 0.4); /* Semi-transparent border */ color: #92400e; /* Solid dark text */ }
CSS note: In modern CSS (2023+), you can write rgb(245 158 11 / 50%) without commas and with a slash before the alpha value. Both syntaxes are valid — the older comma syntax has broader support in older browsers.


HSL Color Codes

Format

hsl(38, 92%, 50%)

HSL stands for Hue, Saturation, Lightness. Unlike hex and RGB which describe color by mixing channels of light, HSL describes color in terms humans actually understand:

For hsl(38, 92%, 50%): hue 38° is a warm orange-amber, 92% saturated (very vivid), at 50% lightness (the full-strength version). This immediately suggests the color is a bright, warm orange — something #f59e0b doesn't communicate at all.

Strengths

  • Intuitive for humans — describes color the way we think about it
  • Perfect for creating variations: just adjust lightness
  • Easier to generate tint/shade scales
  • Makes color relationships visible

Weaknesses

  • Verbose, not as compact as hex
  • Less universally expected in non-CSS tools
  • HSL lightness ≠ perceived brightness (some hues appear brighter at same L value)

Why HSL is Powerful for Generating Color Variations

Say you have a primary button color and you need a hover state (slightly darker), a disabled state (much lighter and desaturated), and a light background tint. In RGB or hex, you'd have to calculate each variant separately. In HSL, you just change the lightness:

:root { --primary-hue: 38; --primary-sat: 92%; } .btn-primary { background: hsl(var(--primary-hue), var(--primary-sat), 50%); /* Base */ } .btn-primary:hover { background: hsl(var(--primary-hue), var(--primary-sat), 42%); /* Darker */ } .btn-primary:disabled { background: hsl(var(--primary-hue), 30%, 80%); /* Muted */ } .highlight-bg { background: hsl(var(--primary-hue), var(--primary-sat), 95%); /* Very light tint */ }

This approach makes your entire color system derived from a single hue value — change the hue variable and every shade updates automatically.

Pick Colors and Get All Three Formats at Once

Stop converting manually. Color Picker & Palette Manager shows you hex, RGB, and HSL the moment you pick any pixel from any website.

Try It Free


HSB/HSV — The Fourth Format You'll See in Design Tools

Figma, Photoshop, and many other design tools default to HSB (Hue, Saturation, Brightness) or HSV (Hue, Saturation, Value) — which is different from HSL, even though the names are similar.

The difference: in HSL, a color at 50% lightness is the pure, fully saturated version. In HSB, full brightness (100%) with full saturation (100%) gives you the pure color, and you can only go darker from there by reducing brightness.

ColorHSLHSB
Pure orangehsl(38, 100%, 50%)hsb(38, 100%, 100%)
Dark orangehsl(38, 100%, 25%)hsb(38, 100%, 50%)
Light orange tinthsl(38, 100%, 90%)hsb(38, 20%, 100%)

When copying color values from Figma, always check which format it's giving you. If you paste an "HSL" value from Figma into CSS and it looks wrong, the tool may have been in HSB mode.



Quick Conversion Reference

HexRGBHSLColor
#f59e0brgb(245, 158, 11)hsl(38, 92%, 50%)
#3b82f6rgb(59, 130, 246)hsl(217, 91%, 60%)
#10b981rgb(16, 185, 129)hsl(160, 84%, 39%)
#dc2626rgb(220, 38, 38)hsl(0, 72%, 51%)
#1a1a1argb(26, 26, 26)hsl(0, 0%, 10%)
#f9fafbrgb(249, 250, 251)hsl(210, 20%, 98%)


Which Format Should You Use?

There's no wrong answer — all formats are valid in CSS — but there are practical conventions:

One thing to watch: HSL and HSB are not interchangeable despite looking similar. If you copy an HSL value from a CSS tool and paste it expecting HSB behavior (or vice versa), your colors will be wrong. Always verify which format a tool is outputting.


Modern CSS Color Formats (LCH, oklch, lab)

Worth a brief mention: CSS Color Level 4 introduces new formats like lch() and oklch() which represent color in a perceptually uniform space. This means that two colors at the same "lightness" value in LCH actually appear equally bright to human eyes — something HSL cannot guarantee (a green at 50% lightness looks much brighter than a blue at 50% lightness).

These formats are supported in modern browsers (Chrome 111+, Firefox 113+, Safari 15.4+) and Figma supports oklch in 2025. For cutting-edge CSS work, they're worth learning. For everyday web design in 2026, hex and HSL remain the practical standards.

Never Manually Convert Color Formats Again

Color Picker & Palette Manager instantly shows the color you pick in every format simultaneously. Click to copy whichever you need.

Add to Chrome — Free


Frequently Asked Questions

What is a hex color code and how do I read it?

A hex code is a 6-character string preceded by # representing a color as three pairs of hexadecimal digits. Each pair is a color channel (red, green, blue). For example, #f59e0b: f5 is red (245), 9e is green (158), 0b is blue (11). Higher values mean more of that channel. #ffffff is white (max all three) and #000000 is black (zero all three).

When should I use HSL instead of hex or RGB?

Use HSL when you need to create color variations programmatically — lighter or darker versions of a color, building a scale, or creating hover states. In HSL, just adjust the lightness value. In hex or RGB, you must recalculate all three channels. HSL is also more intuitive for describing colors in conversation.

What is the difference between RGB and RGBA?

RGBA adds a fourth value — alpha — controlling transparency, from 0 (fully transparent) to 1 (fully opaque). For example, rgba(245, 158, 11, 0.5) is the same orange at 50% transparency. Similarly, HSLA is the transparent version of HSL. Hex can also express transparency using 8 characters (#f59e0b80), but RGBA is more readable for transparent colors.

How do I convert hex to RGB?

Split the hex code into three pairs and convert each from hexadecimal to decimal. For #f59e0b: f5 = 245, 9e = 158, 0b = 11. Result: rgb(245, 158, 11). In practice, use a color picker tool — any decent one shows all formats simultaneously.

Why do some colors look different across screens even with the same hex code?

Different screens have different color gamuts, calibration settings, and gamma curves. A hex code defines a mathematical color value, but how that maps to emitted light depends on the display hardware. A wide-gamut P3 monitor shows more saturated colors than an older sRGB monitor. Working in sRGB color space in your design tool keeps colors consistent across standard displays.

What does HSL stand for and how does it work?

HSL stands for Hue, Saturation, Lightness. Hue is position on the color wheel (0-360°). Saturation is intensity from 0% (gray) to 100% (vivid). Lightness is brightness from 0% (black) to 100% (white), with 50% being the pure color. For example, hsl(38, 92%, 50%) is a vivid amber-orange at full brightness.

Get the Right Color Format Every Time

Pick any color from any website and immediately see it in hex, RGB, and HSL. No manual conversion needed.

Install Color Picker & Palette Manager

Related reading: How to Pick Any Color from a Website  •  How to Create a Color Palette from Any Website  •  Color Picker Tools Every Web Designer Needs

More Free Chrome Tools by Peak Productivity

Pomodoro Technique Timer
Pomodoro Technique Timer
25-minute focus timer with breaks
YouTube Looper Pro
YouTube Looper Pro
Loop any section of a YouTube video
Citation Generator
Citation Generator
Generate APA/MLA/Chicago citations
PDF Merge & Split
PDF Merge & Split
Merge and split PDFs locally
Auto Refresh Ultra
Auto Refresh Ultra
Auto-refresh pages at custom intervals
Screen Recorder Pro
Screen Recorder Pro
Record your screen or tab with audio