English中文日本語한국어EspañolFrançaisDeutschPortuguêsРусский

HTML Color Codes

HTML color codes describe the colors used in web pages, interfaces, charts, buttons, backgrounds, borders, and text.

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