Basic HTML and CSS color
Blue #0000FF
Blue (CSS keyword blue) has the hex code #0000FF and the RGB value rgb(0, 0, 255): a medium-dark, vivid blue.
Blue (#0000ff) is the pure sRGB blue primary and one of the 16 original HTML colors. Its WCAG contrast against white is 8.59:1, which is why fully saturated blue was a workable default for hyperlinks.
Color codes for Blue
| CSS keyword | blue |
|---|---|
| HEX | #0000FF |
| RGB | rgb(0, 0, 255) |
| HSL | hsl(240, 100%, 50%) |
| HWB | hwb(240 0% 0%) |
| OKLCH | oklch(45.2% 0.313 264.1) |
| CMYK (naive, no ICC profile) | cmyk(100%, 100%, 0%, 0%) |
| Decimal | 255 |
| Hue family | Blues |
Contrast and accessibility
On blue, white text has a contrast ratio of 8.59:1 and passes AAA at any text size; black text reaches 2.44:1.
WCAG 2.2 contrast ratios (success criteria 1.4.3 and 1.4.6: AA needs 4.5:1 for normal text and 3:1 for large text, AAA needs 7:1 and 4.5:1). APCA Lc is the lightness contrast from the APCA-W3 0.0.98G model proposed for WCAG 3; a higher absolute value is more readable, and Lc 75 is its suggested minimum for body text.
| Pair | Ratio | AA | AA large | AAA | AAA large | APCA Lc |
|---|---|---|---|---|---|---|
| Black text on blue | 2.44:1 | Fail | Fail | Fail | Fail | 18.2 |
| White text on blue | 8.59:1 | Pass | Pass | Pass | Pass | −90.7 |
| Blue text on white | 8.59:1 | Pass | Pass | Pass | Pass | 85.8 |
| Blue text on black | 2.44:1 | Fail | Fail | Fail | Fail | −16.2 |
Tints and shades
Each step mixes blue with white (tints) or black (shades) in gamma-encoded sRGB, the same result as color-mix(in srgb, blue, white 25%) in CSS.
Tints (mixed with white)
- 5%
#0d0dff - 15%
#2626ff - 25%
#4040ff - 35%
#5959ff - 45%
#7373ff - 55%
#8c8cff - 65%
#a6a6ff - 75%
#bfbfff - 85%
#d9d9ff - 95%
#f2f2ff
Shades (mixed with black)
- 5%
#0000f2 - 15%
#0000d9 - 25%
#0000bf - 35%
#0000a6 - 45%
#00008c - 55%
#000073 - 65%
#000059 - 75%
#000040 - 85%
#000026 - 95%
#00000d
Color harmonies
Rotating the hue in OKLCH while keeping lightness and chroma, blue's complementary color is #734F00 (close to saddlebrown), its analogous colors are #005E8D and #6900D9, and its triadic partners are #AA0011 and #006C00. For text on top, white gives the higher contrast.
| Harmony | Rotation | Color |
|---|---|---|
| Complementary | +180° | #734f00 |
| Analogous | −30°, +30° | #005e8d#6900d9 |
| Triadic | +120°, +240° | #aa0011#006c00 |
| Split-complementary | +150°, +210° | #8c3a00#565c00 |
Computed in OKLCH: the hue is rotated by 180° (complementary), ±30° (analogous), ±120° (triadic) and 180° ±30° (split-complementary) while lightness and chroma stay fixed. Results that fall outside sRGB are brought back with the CSS Color 4 gamut mapping algorithm. Because this uses OKLCH, the values differ from tools that rotate hue in HSL, but every color keeps the same perceived lightness.
Warm or cool?
Blue is a cool color: its hue is 240° on the HSL wheel, in the green, blue and violet range that is conventionally called cool.
Nearest named and Tailwind colors
Distance is ΔE OK, the Euclidean distance in OKLab multiplied by 100. Values under about 2 are hard to tell apart side by side.
Nearest CSS named colors
| Color | HEX | ΔE OK |
|---|---|---|
| mediumblue | #0000cd | 8.3 |
| royalblue | #4169e1 | 16.5 |
| slateblue | #6a5acd | 19.0 |
Nearest Tailwind v4 colors
| Color | HEX | ΔE OK |
|---|---|---|
| blue-700 | #1447e6 | 7.9 |
| indigo-700 | #432dd7 | 9.6 |
| indigo-600 | #4f39f6 | 10.1 |
Code snippets
.element {
color: blue;
background-color: #0000ff;
border-color: rgb(0 0 255);
outline-color: oklch(45.2% 0.313 264.1);
}<div class="bg-[#0000ff] text-white">...</div>
/* or register it once in your CSS (Tailwind v4) */
@theme {
--color-blue: #0000ff;
}
/* then use bg-blue, text-blue, border-blue */import SwiftUI
extension Color {
static let blue = Color(red: 0.000, green: 0.000, blue: 1.000)
}import androidx.compose.ui.graphics.Color
val Blue = Color(0xFF0000FF)import 'package:flutter/material.dart';
const blue = Color(0xFF0000FF);<!-- res/values/colors.xml -->
<color name="blue">#0000FF</color>Frequently asked questions
- What is the hex code for blue?
- The hex code for blue is #0000FF. The same color is rgb(0, 0, 255), hsl(240, 100%, 50%) and oklch(45.2% 0.313 264.1), and in CSS you can also write the keyword blue directly.
- Is blue a warm or cool color?
- Blue is a cool color: its hue is 240° on the HSL wheel, in the green, blue and violet range that is conventionally called cool.
- What colors go with blue?
- Rotating the hue in OKLCH while keeping lightness and chroma, blue's complementary color is #734F00 (close to saddlebrown), its analogous colors are #005E8D and #6900D9, and its triadic partners are #AA0011 and #006C00. For text on top, white gives the higher contrast.
- Can you use white text on blue?
- White text on blue has a contrast ratio of 8.59:1, which passes both AA and AAA under WCAG 2.2. Black text reaches 2.44:1 and fails AA even for large text. In APCA terms that is Lc −90.7 for white and Lc 18.2 for black.
- What is the RGB value of blue?
- Blue is rgb(0, 0, 255): red 0, green 0 and blue 255 on the 0 to 255 scale, or 0.0%, 0.0% and 100.0%. As a decimal integer it is 255.
Last reviewed by Arielton Oberek.