HEX vs. RGB vs. HSL Color Codes: Web Designer Conversion Guide & Cheat Sheet

HEX vs. RGB vs. HSL Color Codes: Web Designer Conversion Guide & Cheat Sheet

Understand how 6-digit hexadecimal color codes map to Red, Green, and Blue (0–255) values in CSS and graphic design.



Every pixel on a computer or smartphone screen is created by mixing three primary light channels: Red, Green, and Blue (RGB), each ranging in intensity from 0 (off) to 255 (full brightness). Web designers and front-end developers switch between HEX (#RRGGBB) and RGB (rgb(r, g, b)) every day. Convert any color code instantly with our free HEX to RGB Converter, RGB to HEX Converter, and All-in-One Color Converter.

How a 6-Digit HEX Color Code Works

A HEX color code starts with # followed by three pairs of hexadecimal (Base-16) digits:

  • First 2 digits (RR): Red channel (00 = 0, FF = 255)
  • Middle 2 digits (GG): Green channel (00 = 0, FF = 255)
  • Last 2 digits (BB): Blue channel (00 = 0, FF = 255)
Color NameHEX CodeRGB ValueCSS Shorthand
Pure Black#000000rgb(0, 0, 0)#000
Pure White#FFFFFFrgb(255, 255, 255)#FFF
Pure Red#FF0000rgb(255, 0, 0)#F00
Emerald Green#2FB344rgb(47, 179, 68)N/A
Royal Blue#206BC4rgb(32, 107, 196)N/A

Optimizing your website stylesheets? Try our HEX to RGB Converter, RGB to HEX Converter, CSS Minifier, and CSS Beautifier.

Frequently asked questions

How do you convert HEX to RGB manually?

Split the 6-character hex code into three 2-character pairs. For each pair, multiply the first hex digit (0–15) by 16 and add the second hex digit (0–15) to get the RGB value between 0 and 255.

What is an 8-digit HEX color code (#RRGGBBAA)?

An 8-digit HEX code adds two extra hexadecimal characters at the end for alpha opacity: 00 is completely transparent (0%), 80 is 50% opacity, and FF is completely opaque (100%).

Cookie
We care about your data and would love to use cookies to improve your experience.