HTML color codes
Pick a color below and copy its code. A color on the web is written four ways, and they all describe the same thing: a hex code like #7A5CFF, the same three channels as rgb(122, 92, 255), an hsl() you can darken without reaching for a picker, or one of 148 names a browser already knows.
The four ways to write a color
All four lines below are the same color, #7A5CFF. Which one you reach for is a question of what you are about to do with it.
Hex
#7A5CFFTwo hexadecimal digits each for red, green and blue, from 00 to FF. The most common way to write a color on the web, and the one every design tool copies to your clipboard.
RGB
rgb(122, 92, 255)The same three channels in decimal, 0 to 255. Easier to reason about when you are changing a value by hand, and the form most programming languages hand you.
HSL
hsl(251, 100%, 68%)Hue as an angle, then saturation and lightness as percentages. The only one of the four you can adjust meaningfully without a picker: drop the lightness and you get the same color, darker.
Name
no CSS keywordOne of 148 words a browser recognizes. Readable and impossible to mistype silently, but only 139 distinct colors are reachable this way, which is why the other three notations exist.
Putting one on the page
/* in a stylesheet */
.headline {
color: #7A5CFF;
background-color: rgb(122, 92, 255);
border-color: hsl(251, 100%, 68%);
}
/* the same color at half opacity, three ways */
.overlay {
background-color: #7A5CFF80;
background-color: rgb(122 92 255 / 50%);
background-color: hsl(251 100% 68% / 50%);
}
<!-- or straight on the element -->
<p style="color: #7A5CFF">Purple text</p>The three lines in .overlay are the same color at half opacity, and a browser takes whichever it understands last. Two extra hex digits carry the alpha, from00 for invisible to FF for solid;rgba() and hsla() are the older spelling of the same thing and still work everywhere.
Note that all of that is CSS. HTML has not set color itself since thebgcolor attribute was dropped from the standard, though browsers still honor it. "HTML color code" is what people say, and it is what this page is called, but every value on it is read by CSS.
The original sixteen
These were the only colors HTML 4.01 named, taken from the VGA palette: eight hues, each at a light and a dark level. Between them they cover most of what anybody looks up - black, white, red, blue, green, yellow, gray - which is why they are still the fastest thing to type. Every other name a browser accepts today arrived later, from X11 by way of SVG, and the old bgcolor attribute never learned any of them.
- #FFFFFF
- #C0C0C0
- #808080
- #000000
- #FF0000
- #800000
- #FFFF00
- #808000
- #00FF00
- #008000
- #00FFFF
- #008080
- #0000FF
- #000080
- #FF00FF
- #800080
The color chart
Every color a browser knows by name, sorted by hue rather than alphabetically, and light to dark inside each band. Click a hex code to copy it, or a name to open its page. The bands are cut at the hue angles named under each heading, which is a measurement rather than an opinion about what the colors are called, and it puts a couple of them somewhere you might not expect. For the RGB and HSL of all of them in one alphabetical table, the color names reference is the page.
Reds
Hue 355 to 15 degrees. CSS brown is here rather than with the oranges: it measures hue 0, which makes it a dark, dulled red. 11 colors.
| Swatch | Color name | Hex | RGB |
|---|---|---|---|
| mistyrose | #FFE4E1 | rgb(255, 228, 225) | |
| lightcoral | #F08080 | rgb(240, 128, 128) | |
| salmon | #FA8072 | rgb(250, 128, 114) | |
| rosybrown | #BC8F8F | rgb(188, 143, 143) | |
| tomato | #FF6347 | rgb(255, 99, 71) | |
| indianred | #CD5C5C | rgb(205, 92, 92) | |
| red | #FF0000 | rgb(255, 0, 0) | |
| firebrick | #B22222 | rgb(178, 34, 34) | |
| brown | #A52A2A | rgb(165, 42, 42) | |
| darkred | #8B0000 | rgb(139, 0, 0) | |
| maroon | #800000 | rgb(128, 0, 0) |
Oranges and browns
Hue 15 to 45. Most of the browns are dark oranges and sit here, saddlebrown and sienna among them. The keyword brown itself does not. 23 colors.
| Swatch | Color name | Hex | RGB |
|---|---|---|---|
| papayawhip | #FFEFD5 | rgb(255, 239, 213) | |
| antiquewhite | #FAEBD7 | rgb(250, 235, 215) | |
| blanchedalmond | #FFEBCD | rgb(255, 235, 205) | |
| bisque | #FFE4C4 | rgb(255, 228, 196) | |
| peachpuff | #FFDAB9 | rgb(255, 218, 185) | |
| moccasin | #FFE4B5 | rgb(255, 228, 181) | |
| navajowhite | #FFDEAD | rgb(255, 222, 173) | |
| wheat | #F5DEB3 | rgb(245, 222, 179) | |
| lightsalmon | #FFA07A | rgb(255, 160, 122) | |
| burlywood | #DEB887 | rgb(222, 184, 135) | |
| darksalmon | #E9967A | rgb(233, 150, 122) | |
| tan | #D2B48C | rgb(210, 180, 140) | |
| sandybrown | #F4A460 | rgb(244, 164, 96) | |
| coral | #FF7F50 | rgb(255, 127, 80) | |
| peru | #CD853F | rgb(205, 133, 63) | |
| darkorange | #FF8C00 | rgb(255, 140, 0) | |
| orange | #FFA500 | rgb(255, 165, 0) | |
| orangered | #FF4500 | rgb(255, 69, 0) | |
| goldenrod | #DAA520 | rgb(218, 165, 32) | |
| chocolate | #D2691E | rgb(210, 105, 30) | |
| sienna | #A0522D | rgb(160, 82, 45) | |
| darkgoldenrod | #B8860B | rgb(184, 134, 11) | |
| saddlebrown | #8B4513 | rgb(139, 69, 19) |
Yellows
Hue 45 to 70 degrees. 11 colors.
| Swatch | Color name | Hex | RGB |
|---|---|---|---|
| lightyellow | #FFFFE0 | rgb(255, 255, 224) | |
| cornsilk | #FFF8DC | rgb(255, 248, 220) | |
| beige | #F5F5DC | rgb(245, 245, 220) | |
| lemonchiffon | #FFFACD | rgb(255, 250, 205) | |
| lightgoldenrodyellow | #FAFAD2 | rgb(250, 250, 210) | |
| palegoldenrod | #EEE8AA | rgb(238, 232, 170) | |
| khaki | #F0E68C | rgb(240, 230, 140) | |
| darkkhaki | #BDB76B | rgb(189, 183, 107) | |
| gold | #FFD700 | rgb(255, 215, 0) | |
| yellow | #FFFF00 | rgb(255, 255, 0) | |
| olive | #808000 | rgb(128, 128, 0) |
Greens
Hue 70 to 165 degrees. 21 colors.
| Swatch | Color name | Hex | RGB |
|---|---|---|---|
| honeydew | #F0FFF0 | rgb(240, 255, 240) | |
| palegreen | #98FB98 | rgb(152, 251, 152) | |
| aquamarine | #7FFFD4 | rgb(127, 255, 212) | |
| lightgreen | #90EE90 | rgb(144, 238, 144) | |
| darkseagreen | #8FBC8F | rgb(143, 188, 143) | |
| mediumaquamarine | #66CDAA | rgb(102, 205, 170) | |
| greenyellow | #ADFF2F | rgb(173, 255, 47) | |
| chartreuse | #7FFF00 | rgb(127, 255, 0) | |
| lime | #00FF00 | rgb(0, 255, 0) | |
| limegreen | #32CD32 | rgb(50, 205, 50) | |
| springgreen | #00FF7F | rgb(0, 255, 127) | |
| yellowgreen | #9ACD32 | rgb(154, 205, 50) | |
| lawngreen | #7CFC00 | rgb(124, 252, 0) | |
| mediumspringgreen | #00FA9A | rgb(0, 250, 154) | |
| mediumseagreen | #3CB371 | rgb(60, 179, 113) | |
| seagreen | #2E8B57 | rgb(46, 139, 87) | |
| olivedrab | #6B8E23 | rgb(107, 142, 35) | |
| forestgreen | #228B22 | rgb(34, 139, 34) | |
| darkolivegreen | #556B2F | rgb(85, 107, 47) | |
| green | #008000 | rgb(0, 128, 0) | |
| darkgreen | #006400 | rgb(0, 100, 0) |
Cyans and teals
Hue 165 to 200 degrees. 17 colors.
| Swatch | Color name | Hex | RGB |
|---|---|---|---|
| lightcyan | #E0FFFF | rgb(224, 255, 255) | |
| paleturquoise | #AFEEEE | rgb(175, 238, 238) | |
| powderblue | #B0E0E6 | rgb(176, 224, 230) | |
| lightblue | #ADD8E6 | rgb(173, 216, 230) | |
| skyblue | #87CEEB | rgb(135, 206, 235) | |
| turquoise | #40E0D0 | rgb(64, 224, 208) | |
| mediumturquoise | #48D1CC | rgb(72, 209, 204) | |
| aqua | #00FFFF | rgb(0, 255, 255) | |
| cadetblue | #5F9EA0 | rgb(95, 158, 160) | |
| cyan | #00FFFF | rgb(0, 255, 255) | |
| deepskyblue | #00BFFF | rgb(0, 191, 255) | |
| darkturquoise | #00CED1 | rgb(0, 206, 209) | |
| lightseagreen | #20B2AA | rgb(32, 178, 170) | |
| darkcyan | #008B8B | rgb(0, 139, 139) | |
| darkslategray | #2F4F4F | rgb(47, 79, 79) | |
| darkslategrey | #2F4F4F | rgb(47, 79, 79) | |
| teal | #008080 | rgb(0, 128, 128) |
Blues
Hue 200 to 260 degrees. 19 colors.
| Swatch | Color name | Hex | RGB |
|---|---|---|---|
| lavender | #E6E6FA | rgb(230, 230, 250) | |
| lightsteelblue | #B0C4DE | rgb(176, 196, 222) | |
| lightskyblue | #87CEFA | rgb(135, 206, 250) | |
| mediumslateblue | #7B68EE | rgb(123, 104, 238) | |
| cornflowerblue | #6495ED | rgb(100, 149, 237) | |
| slateblue | #6A5ACD | rgb(106, 90, 205) | |
| royalblue | #4169E1 | rgb(65, 105, 225) | |
| dodgerblue | #1E90FF | rgb(30, 144, 255) | |
| lightslategray | #778899 | rgb(119, 136, 153) | |
| lightslategrey | #778899 | rgb(119, 136, 153) | |
| blue | #0000FF | rgb(0, 0, 255) | |
| slategray | #708090 | rgb(112, 128, 144) | |
| slategrey | #708090 | rgb(112, 128, 144) | |
| steelblue | #4682B4 | rgb(70, 130, 180) | |
| mediumblue | #0000CD | rgb(0, 0, 205) | |
| darkslateblue | #483D8B | rgb(72, 61, 139) | |
| darkblue | #00008B | rgb(0, 0, 139) | |
| midnightblue | #191970 | rgb(25, 25, 112) | |
| navy | #000080 | rgb(0, 0, 128) |
Purples and magentas
Hue 260 to 305. Purple and magenta are the same hue exactly, 300 degrees, and differ only in lightness, so no boundary can separate them. 15 colors.
| Swatch | Color name | Hex | RGB |
|---|---|---|---|
| thistle | #D8BFD8 | rgb(216, 191, 216) | |
| plum | #DDA0DD | rgb(221, 160, 221) | |
| violet | #EE82EE | rgb(238, 130, 238) | |
| mediumpurple | #9370DB | rgb(147, 112, 219) | |
| orchid | #DA70D6 | rgb(218, 112, 214) | |
| mediumorchid | #BA55D3 | rgb(186, 85, 211) | |
| blueviolet | #8A2BE2 | rgb(138, 43, 226) | |
| darkorchid | #9932CC | rgb(153, 50, 204) | |
| fuchsia | #FF00FF | rgb(255, 0, 255) | |
| magenta | #FF00FF | rgb(255, 0, 255) | |
| darkviolet | #9400D3 | rgb(148, 0, 211) | |
| rebeccapurple | #663399 | rgb(102, 51, 153) | |
| darkmagenta | #8B008B | rgb(139, 0, 139) | |
| indigo | #4B0082 | rgb(75, 0, 130) | |
| purple | #800080 | rgb(128, 0, 128) |
Pinks
Hue 305 to 355 degrees. 7 colors.
| Swatch | Color name | Hex | RGB |
|---|---|---|---|
| pink | #FFC0CB | rgb(255, 192, 203) | |
| lightpink | #FFB6C1 | rgb(255, 182, 193) | |
| hotpink | #FF69B4 | rgb(255, 105, 180) | |
| palevioletred | #DB7093 | rgb(219, 112, 147) | |
| deeppink | #FF1493 | rgb(255, 20, 147) | |
| crimson | #DC143C | rgb(220, 20, 60) | |
| mediumvioletred | #C71585 | rgb(199, 21, 133) |
Whites, grays and blacks
The true neutrals and the whites with a hint of something in them, where a hue angle stops meaning much. 24 colors.
| Swatch | Color name | Hex | RGB |
|---|---|---|---|
| white | #FFFFFF | rgb(255, 255, 255) | |
| ghostwhite | #F8F8FF | rgb(248, 248, 255) | |
| snow | #FFFAFA | rgb(255, 250, 250) | |
| mintcream | #F5FFFA | rgb(245, 255, 250) | |
| aliceblue | #F0F8FF | rgb(240, 248, 255) | |
| azure | #F0FFFF | rgb(240, 255, 255) | |
| floralwhite | #FFFAF0 | rgb(255, 250, 240) | |
| ivory | #FFFFF0 | rgb(255, 255, 240) | |
| lavenderblush | #FFF0F5 | rgb(255, 240, 245) | |
| seashell | #FFF5EE | rgb(255, 245, 238) | |
| whitesmoke | #F5F5F5 | rgb(245, 245, 245) | |
| oldlace | #FDF5E6 | rgb(253, 245, 230) | |
| linen | #FAF0E6 | rgb(250, 240, 230) | |
| gainsboro | #DCDCDC | rgb(220, 220, 220) | |
| lightgray | #D3D3D3 | rgb(211, 211, 211) | |
| lightgrey | #D3D3D3 | rgb(211, 211, 211) | |
| silver | #C0C0C0 | rgb(192, 192, 192) | |
| darkgray | #A9A9A9 | rgb(169, 169, 169) | |
| darkgrey | #A9A9A9 | rgb(169, 169, 169) | |
| gray | #808080 | rgb(128, 128, 128) | |
| grey | #808080 | rgb(128, 128, 128) | |
| dimgray | #696969 | rgb(105, 105, 105) | |
| dimgrey | #696969 | rgb(105, 105, 105) | |
| black | #000000 | rgb(0, 0, 0) |
Colors you can write as a word
A browser recognizes 148 color names, covering 139 distinct colors, because nine of the names are exact duplicates of another. Names are readable and impossible to mistype silently, since an unrecognized one is ignored rather than rendering something wrong. They are also a narrow palette with no system behind it, which is what the other three notations are for.
- red
- orange
- gold
- olive
- lime
- teal
- navy
- indigo
- orchid
- crimson
- salmon
- khaki
- plum
- tan
- rebeccapurple
Common questions
- Are HTML color codes and CSS color codes the same thing?
- In practice, yes. Color is set by CSS rather than by HTML, and has been for a long time, but HTML color code is the phrase almost everybody uses and searches for. The values are identical either way: the same hex, RGB, HSL and names apply whether you write them in a style attribute, a stylesheet, or a framework class.
- What is a hex color code?
- A hex code is six hexadecimal digits, two each for red, green and blue, from 00 to FF. #7A5CFF is 122 red, 92 green and 255 blue. Hexadecimal counts 0 to 9 then A to F, so FF is 255, the largest a single channel goes. The hash is part of the value and CSS will not read it without one.
- How many HTML colors are there?
- 16,777,216, which is 256 values for each of the three channels. Only 139 of them have a name a browser recognizes, which is why hex, RGB and HSL exist: they reach every color, and the names reach 139.
- What are the 16 original HTML colors?
- White, silver, gray, black, red, maroon, yellow, olive, lime, green, aqua, teal, blue, navy, fuchsia and purple. They came from the VGA palette and were the only colors HTML 4.01 named. Everything else a browser recognizes today arrived later, from X11 by way of SVG.
- Should I use hex, RGB or HSL?
- Hex for anything you paste from a design tool, which is most of the time. RGB when you are working with a value in code, since the channels are plain decimal numbers. HSL when you want to adjust a color by hand rather than replace it: drop the lightness and you have the same color, darker, which neither of the other two lets you do without a calculator.
- What is the difference between #RGB, #RRGGBB and #RRGGBBAA?
- Three digits is shorthand: each one is doubled, so #F0A means #FF00AA. Six is the ordinary form. Eight adds two more digits of alpha, from 00 for fully transparent to FF for fully opaque, so #FF000080 is red at about half. Four digits is the shorthand of the eight-digit form. All four are valid CSS and every current browser reads them.
- How do I use a color code in HTML?
- Through CSS, either in a stylesheet or in a style attribute on the element. color sets the text, background-color sets the panel behind it and border-color sets the outline. The old bgcolor and text attributes still work in most browsers but were removed from the standard, and they only ever understood the original sixteen names.