Every named color supported by HTML and CSS, with its HEX, RGB and HSL code. Search by name or code, filter by color family, sort by hue or lightness, and click any color to copy its code. The 216-color web-safe palette is one tab away.
Aa
coral
Each block shares one red value (00 to FF); rows change green and columns change blue. Click a cell to copy its HEX code.
Advertisement
Advertisement
How to use the HTML Color Codes
Browse or search: scroll the grid, or type a name ("blue", "sea") or a HEX code ("#ff7f50") in the search box.
Filter by color family with the chips, and choose how to sort the grid: by family, name, hue, lightness or HEX.
Pick a copy format: name, HEX, RGB or HSL.
Click a color to copy its code. The detail panel shows every format with its own copy button and the contrast against white and black text.
Need web-safe colors? Open the Web-safe palette tab and click any of the 216 cells to copy its HEX code.
How HTML color codes work
A HEX color code such as #FF7F50 is three pairs of hexadecimal digits for the red, green and blue channels. Each pair runs from 00 (0, none of that light) to FF (255, full intensity), so #FF7F50 means red 255, green 127, blue 80, which is rgb(255, 127, 80) and the named color coral. A three-digit shorthand doubles each digit: #369 is #336699.
HSL describes the same color as hue (0 to 360 degrees around the color wheel: 0 red, 120 green, 240 blue), saturation (0% gray to 100% vivid) and lightness (0% black, 50% pure color, 100% white). It is the easiest format for making a color a little lighter or darker by hand.
Format
Example (coral)
CSS usage
Color name
coral
color: coral;
HEX
#FF7F50
color: #ff7f50;
HEX with alpha
#FF7F5080
color: #ff7f5080; (50% opacity)
RGB
rgb(255, 127, 80)
color: rgb(255 127 80 / 50%);
HSL
hsl(16, 100%, 66%)
color: hsl(16 100% 66%);
The 16 basic HTML colors
These 16 names date back to HTML 3.2 (1997) and are the ones you will see most often in older code and tutorials. The other names were added from the X11 window system color list.
Name
HEX
RGB
Name
HEX
RGB
black
#000000
0, 0, 0
silver
#C0C0C0
192, 192, 192
gray
#808080
128, 128, 128
white
#FFFFFF
255, 255, 255
maroon
#800000
128, 0, 0
red
#FF0000
255, 0, 0
purple
#800080
128, 0, 128
fuchsia
#FF00FF
255, 0, 255
green
#008000
0, 128, 0
lime
#00FF00
0, 255, 0
olive
#808000
128, 128, 0
yellow
#FFFF00
255, 255, 0
navy
#000080
0, 0, 128
blue
#0000FF
0, 0, 255
teal
#008080
0, 128, 128
aqua
#00FFFF
0, 255, 255
Note that the CSS green is a medium green (#008000); the pure, full-intensity green channel is called lime.
Choosing readable text colors
The detail panel shows the WCAG 2 contrast ratio of the selected color against white and black text. The ratio is (L1 + 0.05) / (L2 + 0.05), where L1 and L2 are the relative luminances of the lighter and darker color. Body text needs at least 4.5:1 for level AA and 7:1 for AAA; large text (about 24 px, or 19 px bold) needs 3:1. For example, white text on steelblue reaches only about 4.1:1, while white on navy is well above 7:1. To check any two colors, use the Color Contrast Checker.
Frequently asked questions
How many HTML color names are there?
There are 140 classic HTML color names that every browser supports, such as red, navy, coral and lightgoldenrodyellow. CSS Color Level 4 adds rebeccapurple (#663399), and it also accepts the British spelling grey in seven names (grey, darkgrey, lightgrey, dimgrey, slategrey, darkslategrey, lightslategrey), for 148 keywords in total. This page lists the 141 distinct names.
Are HTML color names case-sensitive?
No. CSS color keywords are case-insensitive, so Red, RED and red all mean #FF0000. Most style guides write them in lowercase, which is how the code is copied from this page.
Do some color names share the same code?
Yes. aqua and cyan are both #00FFFF, and fuchsia and magenta are both #FF00FF. The gray and grey spellings are also identical.
What are web-safe colors?
The web-safe palette is 216 colors made from every combination of the values 00, 33, 66, 99, CC and FF for red, green and blue. It was designed for 1990s screens that could only show 256 colors. Modern displays show millions of colors, so you no longer have to stick to it, but its short codes like #369 are still handy.
Should I use color names or HEX codes in CSS?
Both work in every browser. Names are easier to read in quick prototypes, while HEX, RGB or HSL give you the exact shade you need from a design and are used by most design tools. The rendered color is identical for a name and its HEX value.
Why is "darkgray" lighter than "gray"?
It is a historical quirk. The CSS names came from the X11 color list, where darkgray is #A9A9A9, while gray was taken from the older HTML 3.2 set at #808080. So darkgray ends up lighter than gray.
How do I write a color code in HTML?
Use CSS, for example style="color: tomato" or style="background-color: #FF6347" or color: rgb(255, 99, 71). All three give the same tomato red.