What are HTML color codes?
HTML color codes are values that browsers can understand. The most common formats are Hex, RGB, HSL, named colors, and newer CSS formats such as OKLCH. They all describe the same idea: which color should appear on the screen.
Which format should you use?
Hex is compact and common in design handoff. RGB is direct when you need red, green, and blue channels. HSL is easier for adjusting hue, saturation, and lightness. OKLCH is useful for modern perceptual color palettes.
Using colors in CSS
You can place color values in CSS properties such as color, background-color, border-color, outline-color, box-shadow, gradients, SVG fills, and chart styles. Always check contrast when colors are used for text.
Related color tools
Use these tools to pick, convert, test, and export the color values described in this guide.
More color guides
Color GuidesPractical guides for HTML color codes, Hex values, RGB, HSL, CSS colors, palettes, web safe colors, and shades.Hex Color CodesA guide to Hex color codes, six-digit #RRGGBB values, shorthand Hex colors, and Hex to RGB conversion.RGB Color CodesUnderstand RGB color codes, convert RGB to Hex, and use rgb() values in CSS.HSL Color CodesLearn HSL color codes, hue angles, saturation, lightness, and how to use hsl() in CSS.CSS Color CodesUse CSS color codes in stylesheets, gradients, borders, shadows, SVG, and interface design.Color Palette GeneratorGenerate color palettes from a base color, image, color wheel, harmony, shades, tints, and tones.Web Safe ColorsExplore web safe colors, classic browser-safe palettes, Hex values, and modern alternatives.Color Shades GeneratorCreate color shades, tints, tones, and variations from any Hex, RGB, HSL, or OKLCH color.