Developer7 min readUpdated 2026-03-09

HEX Color Codes — The Complete Reference Guide

Tools mentioned in this 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 CodeRGBColor
#FFFFFF255255255 White
#000000000 Black
#E8530A2328310 Red-Orange
#5CBBF692187246 Sky Blue
#2ECC7146204113 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

ColorHexCommon Use
Red#FF0000Alerts, errors, urgency
Green#00FF00Success, confirmations
Blue#0000FFLinks, tech, trust
Yellow#FFFF00Warnings, highlights
Cyan#00FFFFTech, futuristic
Magenta#FF00FFCreative, bold

Popular Brand & UI Colors

ColorHexCommon Use
Coral#FF6F61Warm accents
Teal#008080Professional, calm
Slate Gray#708090Text, backgrounds
Gold#FFD700Premium, highlights
Navy#000080Corporate, headers
Tomato#FF6347CTAs, emphasis
Steel Blue#4682B4UI elements
Hot Pink#FF69B4Playful, bold

Grayscale

ShadeHex
White#FFFFFF
Light Gray#D3D3D3
Gray#808080
Dark Gray#404040
Black#000000

Hex vs RGB vs HSL

FormatExample (same color)Best For
Hex#3498DBCSS, design tools, quick reference
RGBrgb(52, 152, 219)Dynamic color in JavaScript
HSLhsl(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

  1. Use a Color Picker tool — our Color Picker lets you pick any color and get the hex code instantly.
  2. Extract from an image — upload an image to a color picker and click the shade you want.
  3. Browser DevTools — right-click any element → Inspect → find color values in the CSS panel.
  4. Design tools — Figma, Sketch, Canva, and Photoshop all show hex codes in their color panels.
  5. 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

  1. Check contrast ratios — WCAG requires 4.5:1 contrast between text and background for accessibility. Use a contrast checker before committing to a palette.
  2. Limit your palette — 3–5 colors is enough for most designs. Too many colors creates visual chaos.
  3. Create variations — use lighter/darker shades of the same base color for hierarchy. For example, #3498DB for buttons and #2980B9 for hover states.
  4. Test in dark mode — colors that look great on white can be harsh or illegible on dark backgrounds.
  5. 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.
  6. 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?
A # 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?
Use our Color Picker tool, browser DevTools (Inspect Element → color values in CSS), or a desktop app like macOS Digital Color Meter or PowerToys Color Picker on Windows.
What's the difference between hex and RGB?
They represent the same colors in different formats. #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?
Yes — use 8-digit hex. Add two digits for the alpha channel: #FF000080 = red at 50% opacity. All modern browsers support this format.
What are the hex codes for black and white?
Black = #000000, White = #FFFFFF. Common grays: #333333 (dark), #808080 (mid), #CCCCCC (light).
Does capitalization matter in hex codes?
No. #ff5733, #FF5733, and #Ff5733 are all identical. Convention is all uppercase or all lowercase — pick one and be consistent.

Ready to try it?

Use the tool right now — free, no signup, no upload.