Skip to content

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

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

Color codes for Blue
CSS keywordblue
HEX#0000FF
RGBrgb(0, 0, 255)
HSLhsl(240, 100%, 50%)
HWBhwb(240 0% 0%)
OKLCHoklch(45.2% 0.313 264.1)
CMYK (naive, no ICC profile)cmyk(100%, 100%, 0%, 0%)
Decimal255
Hue familyBlues

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.

Contrast and accessibility
PairRatioAAAA largeAAAAAA largeAPCA Lc
Black text on blue2.44:1FailFailFailFail18.2
White text on blue8.59:1PassPassPassPass−90.7
Blue text on white8.59:1PassPassPassPass85.8
Blue text on black2.44:1FailFailFailFail−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)

  1. 5%
    #0d0dff
  2. 15%
    #2626ff
  3. 25%
    #4040ff
  4. 35%
    #5959ff
  5. 45%
    #7373ff
  6. 55%
    #8c8cff
  7. 65%
    #a6a6ff
  8. 75%
    #bfbfff
  9. 85%
    #d9d9ff
  10. 95%
    #f2f2ff

Shades (mixed with black)

  1. 5%
    #0000f2
  2. 15%
    #0000d9
  3. 25%
    #0000bf
  4. 35%
    #0000a6
  5. 45%
    #00008c
  6. 55%
    #000073
  7. 65%
    #000059
  8. 75%
    #000040
  9. 85%
    #000026
  10. 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.

Color harmonies
HarmonyRotationColor
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

Nearest CSS named colors
ColorHEXΔE OK
mediumblue#0000cd8.3
royalblue#4169e116.5
slateblue#6a5acd19.0

Nearest Tailwind v4 colors

Nearest Tailwind v4 colors
ColorHEXΔE OK
blue-700#1447e67.9
indigo-700#432dd79.6
indigo-600#4f39f610.1

Code snippets

CSS
.element {
  color: blue;
  background-color: #0000ff;
  border-color: rgb(0 0 255);
  outline-color: oklch(45.2% 0.313 264.1);
}
Tailwind CSS
<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 */
SwiftUI
import SwiftUI

extension Color {
  static let blue = Color(red: 0.000, green: 0.000, blue: 1.000)
}
Jetpack Compose
import androidx.compose.ui.graphics.Color

val Blue = Color(0xFF0000FF)
Flutter
import 'package:flutter/material.dart';

const blue = Color(0xFF0000FF);
Android XML
<!-- 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.