HTML Color Codes
Copy common HTML color codes and learn how HEX, RGB, HSL and named colors map to CSS.
Basic HTML colors
Popular modern colors
HTML color code formats
Modern HTML and CSS accept several color formats: HEX values such as #4F46E5, RGB functions such as rgb(79, 70, 229), HSL functions such as hsl(243, 75%, 59%), and named colors such as royalblue.
Frequently asked questions
What is an HTML color code?+
An HTML color code is any CSS color value used to style HTML elements, most commonly HEX, RGB, HSL or a named color.
Should I use HEX or RGB?+
Use HEX for compact static colors and RGB or HSL when you need alpha, calculations or easier design-token manipulation.
Can I use 3-digit HEX codes?+
Yes. A 3-digit HEX code is shorthand: #F0A expands to #FF00AA.
Related tools
Color Converter
Convert any color between HEX, RGB, HSL, HSV and CMYK.
HEX to RGB
Convert HEX color codes to RGB instantly.
RGB to HEX
Convert RGB color values to HEX codes.
Palette Generator
Generate beautiful 5-color palettes in seconds.
Contrast Checker
Check WCAG AA / AAA contrast for text and backgrounds.
CSS Gradient Generator
Build linear and radial gradients with live preview.