HEX Color Codes — The Complete Reference Guide
Hex color codes are everywhere — websites, apps, design tools, CSS stylesheets. They're the universal language for defining exact colors in digital design. Whether you're picking a brand color, matching a shade from a screenshot, or writing CSS — understanding hex codes gives you precise control.
Need to find or pick a hex color right now? Use our free Color Picker — no signup needed.
What Is a Hex Color Code?
A hex color code is a 6-character string that defines a color using the RGB (Red, Green, Blue) color model. It starts with a # followed by three pairs of hexadecimal digits:
#RRGGBB
Each pair ranges from 00 (none) to FF (maximum intensity):
#FF0000= pure Red (max red, no green, no blue)#00FF00= pure Green#0000FF= pure Blue#000000= Black (all channels off)#FFFFFF= White (all channels max)
Hexadecimal uses 0–9 and A–F, giving 256 values per channel (16 × 16) and over 16.7 million possible colors.
How to Read Hex Color Codes
| Hex Code | R | G | B | Color |
|---|---|---|---|---|
#FFFFFF | 255 | 255 | 255 | White |
#000000 | 0 | 0 | 0 | Black |
#E8530A | 232 | 83 | 10 | Red-Orange |
#5CBBF6 | 92 | 187 | 246 | Sky Blue |
#2ECC71 | 46 | 204 | 113 | Emerald Green |
Shorthand notation: When each pair has identical digits, you can shorten to 3 characters:
#FF5500→#F50#AABBCC→#ABC
Common Hex Color Codes Reference
Primary Colors
| Color | Hex | Common Use |
|---|---|---|
| Red | #FF0000 | Alerts, errors, urgency |
| Green | #00FF00 | Success, confirmations |
| Blue | #0000FF | Links, tech, trust |
| Yellow | #FFFF00 | Warnings, highlights |
| Cyan | #00FFFF | Tech, futuristic |
| Magenta | #FF00FF | Creative, bold |
Popular Brand & UI Colors
| Color | Hex | Common Use |
|---|---|---|
| Coral | #FF6F61 | Warm accents |
| Teal | #008080 | Professional, calm |
| Slate Gray | #708090 | Text, backgrounds |
| Gold | #FFD700 | Premium, highlights |
| Navy | #000080 | Corporate, headers |
| Tomato | #FF6347 | CTAs, emphasis |
| Steel Blue | #4682B4 | UI elements |
| Hot Pink | #FF69B4 | Playful, bold |
Grayscale
| Shade | Hex |
|---|---|
| White | #FFFFFF |
| Light Gray | #D3D3D3 |
| Gray | #808080 |
| Dark Gray | #404040 |
| Black | #000000 |
Hex vs RGB vs HSL
| Format | Example (same color) | Best For |
|---|---|---|
| Hex | #3498DB | CSS, design tools, quick reference |
| RGB | rgb(52, 152, 219) | Dynamic color in JavaScript |
| HSL | hsl(204, 70%, 53%) | Adjusting lightness/saturation intuitively |
- Hex is the most compact and widely used in CSS and design
- RGB is intuitive when you need to calculate colors programmatically
- HSL is best when you want to create color variations — just change the lightness value
Use our Color Picker to convert between all three formats instantly.
How to Find the Hex Code for Any Color
- Use a Color Picker tool — our Color Picker lets you pick any color and get the hex code instantly.
- Extract from an image — upload an image to a color picker and click the shade you want.
- Browser DevTools — right-click any element → Inspect → find color values in the CSS panel.
- Design tools — Figma, Sketch, Canva, and Photoshop all show hex codes in their color panels.
- Brand guidelines — most companies publish their exact hex codes in brand kits and style guides.
Using Hex Colors in CSS
/* Basic usage */
body {
background-color: #F5F5F5;
color: #333333;
}
/* Borders and accents */
.button {
background-color: #3498DB;
border: 2px solid #2980B9;
color: #FFFFFF;
}
/* Hex with transparency (8-digit) */
.overlay {
background-color: #00000080; /* black at 50% opacity */
}
The 8-digit hex format adds transparency: the last two digits control opacity (00 = fully transparent, FF = fully opaque). Supported in all modern browsers.
Tips for Choosing Hex Colors
- Check contrast ratios — WCAG requires 4.5:1 contrast between text and background for accessibility. Use a contrast checker before committing to a palette.
- Limit your palette — 3–5 colors is enough for most designs. Too many colors creates visual chaos.
- Create variations — use lighter/darker shades of the same base color for hierarchy. For example,
#3498DBfor buttons and#2980B9for hover states. - Test in dark mode — colors that look great on white can be harsh or illegible on dark backgrounds.
- Consider color blindness — 8% of men have some form of color vision deficiency. Never rely on color alone to convey meaning — add labels, icons, or patterns.
- Learn from real brands — study color palettes of successful products. Most use a primary, secondary, and accent color with intentional contrast.
Frequently Asked Questions
What does a hex color code look like?▼
# followed by 6 characters using 0–9 and A–F. Example: #3498DB is a medium blue. Shorthand like #F00 (red) works when each pair repeats.How do I find the hex color of something on my screen?▼
What's the difference between hex and RGB?▼
#FF5733 in hex equals rgb(255, 87, 51) in RGB. Hex is shorter to write in CSS; RGB is easier to read as individual channel numbers.Can hex colors have transparency?▼
#FF000080 = red at 50% opacity. All modern browsers support this format.What are the hex codes for black and white?▼
#000000, White = #FFFFFF. Common grays: #333333 (dark), #808080 (mid), #CCCCCC (light).Does capitalization matter in hex codes?▼
#ff5733, #FF5733, and #Ff5733 are all identical. Convention is all uppercase or all lowercase — pick one and be consistent.