THE COLOR LIBRARY / Cool
Blue color codes.
The CSS blue color code is #0000FF. Its RGB value is rgb(0, 0, 255) and its HSL value is hsl(240, 100%, 50%). Start with the exact reference, then choose a shade for the job.
A color name describes a family in everyday language. This page uses the standardized CSS keyword as its reference; your brand’s blue may be different.
Explore the shades ↓COPY. PASTE. MAKE IT YOURS.
Blue in HEX, RGB, and HSL
#0000FFrgb(0, 0, 255)hsl(240, 100%, 50%)HEX and RGB encode the same sRGB reference. HSL is calculated from it and rounded to two decimals for display. These are screen color values, not a CMYK print specification.
ONE COLOR. DIFFERENT ROLES.
Explore blue tints and shades
Select a swatch to see its codes and compare text contrast.
Make the next step clear.
A label, a surface, and room to breathe.
Selected: ReferenceSelected color
Reference · #0000FF
rgb(0, 0, 255)hsl(240, 100%, 50%)The specimen picks whichever of black or white has higher contrast. It demonstrates a pair, not a complete accessible component.
Illustrative scale: tints mix the reference with white, shades with black, by the stated percentage in encoded sRGB channels. This is not a perceptually uniform scale. Black tints and white shades remain useful; mixing black with black or white with white repeats the reference.
Text contrast on blue
The table follows your selected swatch, currently #0000FF. Decisions use the full calculated ratio; displayed ratios are rounded.
| Text color | Ratio | AA ordinary text | AA large text |
|---|---|---|---|
| Black #000000 | 2.44:1 | Fail · 4.5:1 | Fail · 3:1 |
| White #FFFFFF | 8.59:1 | Pass · 4.5:1 | Pass · 3:1 |
Large text is at least 18pt, or 14pt bold. These numeric checks apply to opaque, solid color pairs. Other criteria, states, backgrounds, and exceptions need review. Read W3C’s contrast guidance.
Pure CSS blue is highly saturated. It can meet a numeric contrast threshold and still feel visually harsh in a large surface; review comfort and hierarchy separately.
Check a custom color pair ↗IN A REAL INTERFACE
How to use blue in product design
Give it one clear role
Blue can support links, selected controls, or a primary action, provided these roles are documented. A blue brand does not mean every interactive element should use the same fill.
A UI example to try
Use a blue underline for an inline link and a filled button for the main action. Give visited, hover, and keyboard-focus states their own specifications rather than changing only opacity.
Work through a real screen
Create a specimen with a link, a primary action, and a selected row. Decide whether all three should share a family and how their roles remain distinct through underline, shape, placement, and wording. A blue label without link treatment can be mistaken for ordinary text, while blue decorative text can imply an interaction.
Compare nearby colors by purpose
Compare blue with navy when a darker surface or foreground is needed, and cyan when a lighter accent is intended. Changing the hue family is not a substitute for checking the actual contrast and interaction hierarchy.
- Choose the role. Decide whether blue is a surface, foreground, accent, or status. Name the semantic token after that purpose.
- Test the actual pair. Compare its foreground and background at the intended size. Test hover, selected, focus, and supported themes independently.
- Document the decision. Keep the approved code, usage rule, and contrasting companion together. Preserve labels and non-color cues when communicating a state.
Copy a blue CSS palette
These numeric names are illustrative palette tokens, not a standard scale. Connect approved values to semantic tokens such as --surface-highlight or --text-primary after testing their pairs.
:root {
--blue-100: #CCCCFF;
--blue-300: #6666FF;
--blue-500: #0000FF;
--blue-700: #0000BF;
--blue-900: #000080;
}Common questions about blue
What is the HEX code for blue?
The CSS named color blue is #0000FF. Use that exact value when you want the standardized reference; use your own documented token when you mean a particular brand shade.
Is blue accessible?
A color by itself cannot pass or fail accessibility. The foreground/background pair, content size, interaction state, and meaning all matter. Use the table above for the selected solid-color pair, then review the complete interface.