Free tools Windows power users keep installed
One-click scans. No signup required.
iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
“HTML color codes” is a familiar name for colors used on web pages, but today those colors are specified with CSS. The term usually means named colors such as purple or hexadecimal values such as #800080. CSS also supports RGB, HSL, HWB, and other color spaces.
What does “HTML color code” mean?
It is an informal, legacy umbrella term for a way to identify a color on a web page. Modern web color values belong to CSS, not HTML. MDN Web Docs puts it plainly: “It is no longer accurate to refer to colors on the web as ‘HTML color codes’ or ‘HTML color names’.” See the MDN glossary entry.
The term persists because older HTML references described colors as either hexadecimal values or a set of color names. The HTML 4.01 reference also marked using HTML elements and attributes to set colors as deprecated. For modern pages, set a CSS color property instead, for example color: #663399; or background-color: rebeccapurple;. The HTML 4.01 color reference is historical; current syntax is documented in the MDN CSS colors guide.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWhich color formats are commonly used?
These formats are different notations for specifying colors. Changing the notation alone does not change the color.
#1 Best Overall
| Format | What it represents | Useful when |
|---|---|---|
| Named color | A CSS keyword such as red, lightseagreen, or rebeccapurple. |
You want a readable value and a standard keyword matches the intended shade. |
| Hexadecimal | Red, green, and blue components encoded as hexadecimal digits, typically #rrggbb. |
You need to copy an exact channel value from a design specification or another source. |
| RGB | Red, green, and blue components, associated with the sRGB color space in the traditional form. | You want to specify channel values directly or use a functional color notation. |
| HSL | Hue, saturation, and lightness. | You want to adjust those dimensions in terms that are often easier to reason about than separate RGB channels. |
| HWB | Hue, whiteness, and blackness. | You prefer to describe a color in terms of its hue and the amount of white or black. |
CSS also includes color functions for CIELAB-based forms such as lab() and lch(), perceptual forms such as oklab() and oklch(), and other color spaces through color(). Consult the CSS colors guide for the broader set of supported syntax.
How do hex color codes work?
A hex color starts with # and uses hexadecimal digits to encode red, green, and blue. In the six-digit form, #rrggbb, each pair represents one channel. For example, #ff0000 is red. Hexadecimal letters are case-insensitive.
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
#rrggbbis the six-digit form for an opaque color.#rgbis a shorter shorthand;#f00represents the same red as#ff0000.#rrggbbaaadds an alpha component for opacity.- CSS also supports the four-digit shorthand form, which includes alpha.
Use an alpha-bearing form only when transparency is intended. The details of CSS hexadecimal notation are in the MDN hex color reference.
How do named colors differ from exact values?
Named colors make styles easy to read: blue communicates intent more clearly than a numeric sequence at a glance. But the keyword set is limited, so it cannot name every exact shade in a design. MDN Web Docs lists over 160 named colors; the retrieved reference does not state a publication year. See the named color reference.
Rank #3
Keywords are case-insensitive. CSS also has the special named values transparent and currentColor. Use a named color when its standard shade is suitable; choose an explicit value when a project calls for a precise color.
How should you choose a notation?
- Choose a named color for a quick, readable style when the standard keyword is the shade you want.
- Choose hex or RGB when copying exact red, green, and blue channel values from a specification.
- Choose HSL when you want to adjust hue, saturation, or lightness as separate dimensions.
- Use alpha in hex or a functional color form only if the color needs transparency.
To inspect equivalents, MDN’s CSS color guide and converter can show a selected color in RGB, HEX, HSL, and HWB. Those values are alternate representations of the same color.
Quick Recap
Best Value
Rank #4
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

