Skip to content

Basic HTML and CSS color

Yellow #FFFF00

Yellow (CSS keyword yellow) has the hex code #FFFF00 and the RGB value rgb(255, 255, 0): a very light, vivid yellow.

Yellow#FFFF00

Yellow (#ffff00) is one of the 16 original HTML colors, full red plus full green. It has the highest luminance of any fully saturated color, so its contrast with white is only 1.07:1.

Color codes for Yellow

Color codes for Yellow
CSS keywordyellow
HEX#FFFF00
RGBrgb(255, 255, 0)
HSLhsl(60, 100%, 50%)
HWBhwb(60 0% 0%)
OKLCHoklch(96.8% 0.211 109.8)
CMYK (naive, no ICC profile)cmyk(0%, 0%, 100%, 0%)
Decimal16,776,960
Hue familyYellows

Contrast and accessibility

On yellow, black text has a contrast ratio of 19.55:1 and passes AAA at any text size; white text reaches 1.07: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 yellow19.55:1PassPassPassPass101.4
White text on yellow1.07:1FailFailFailFail0.0
Yellow text on white1.07:1FailFailFailFail0.0
Yellow text on black19.55:1PassPassPassPass−102.7

Tints and shades

Each step mixes yellow with white (tints) or black (shades) in gamma-encoded sRGB, the same result as color-mix(in srgb, yellow, white 25%) in CSS.

Tints (mixed with white)

  1. 5%
    #ffff0d
  2. 15%
    #ffff26
  3. 25%
    #ffff40
  4. 35%
    #ffff59
  5. 45%
    #ffff73
  6. 55%
    #ffff8c
  7. 65%
    #ffffa6
  8. 75%
    #ffffbf
  9. 85%
    #ffffd9
  10. 95%
    #fffff2

Shades (mixed with black)

  1. 5%
    #f2f200
  2. 15%
    #d9d900
  3. 25%
    #bfbf00
  4. 35%
    #a6a600
  5. 45%
    #8c8c00
  6. 55%
    #737300
  7. 65%
    #595900
  8. 75%
    #404000
  9. 85%
    #262600
  10. 95%
    #0d0d00

Color harmonies

Rotating the hue in OKLCH while keeping lightness and chroma, yellow's complementary color is #F3F1FF (close to aliceblue), its analogous colors are #FFF0C1 and #D0FFC3, and its triadic partners are #D7FBFF and #FFE9F9. For text on top, black gives the higher contrast.

Color harmonies
HarmonyRotationColor
Complementary+180°#f3f1ff
Analogous−30°, +30°#fff0c1#d0ffc3
Triadic+120°, +240°#d7fbff#ffe9f9
Split-complementary+150°, +210°#e7f6ff#ffeaff

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?

Yellow is a warm color: its hue is 60° on the HSL wheel, in the red, orange and yellow range (0° to about 70°, plus reds above 330°) that is conventionally called warm.

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
greenyellow#adff2f9.8
gold#ffd7009.9
khaki#f0e68c11.5

Nearest Tailwind v4 colors

Nearest Tailwind v4 colors
ColorHEXΔE OK
yellow-300#ffdf208.0
yellow-200#fff0858.8
lime-300#bbf4519.4

Code snippets

CSS
.element {
  color: yellow;
  background-color: #ffff00;
  border-color: rgb(255 255 0);
  outline-color: oklch(96.8% 0.211 109.8);
}
Tailwind CSS
<div class="bg-[#ffff00] text-black">...</div>

/* or register it once in your CSS (Tailwind v4) */
@theme {
  --color-yellow: #ffff00;
}
/* then use bg-yellow, text-yellow, border-yellow */
SwiftUI
import SwiftUI

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

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

const yellow = Color(0xFFFFFF00);
Android XML
<!-- res/values/colors.xml -->
<color name="yellow">#FFFF00</color>

Frequently asked questions

What is the hex code for yellow?
The hex code for yellow is #FFFF00. The same color is rgb(255, 255, 0), hsl(60, 100%, 50%) and oklch(96.8% 0.211 109.8), and in CSS you can also write the keyword yellow directly.
Is yellow a warm or cool color?
Yellow is a warm color: its hue is 60° on the HSL wheel, in the red, orange and yellow range (0° to about 70°, plus reds above 330°) that is conventionally called warm.
What colors go with yellow?
Rotating the hue in OKLCH while keeping lightness and chroma, yellow's complementary color is #F3F1FF (close to aliceblue), its analogous colors are #FFF0C1 and #D0FFC3, and its triadic partners are #D7FBFF and #FFE9F9. For text on top, black gives the higher contrast.
Can you use white text on yellow?
White text on yellow has a contrast ratio of 1.07:1, which fails AA even for large text under WCAG 2.2. Black text reaches 19.55:1 and passes both AA and AAA. In APCA terms that is Lc 0.0 for white and Lc 101.4 for black.
What is the RGB value of yellow?
Yellow is rgb(255, 255, 0): red 255, green 255 and blue 0 on the 0 to 255 scale, or 100.0%, 100.0% and 0.0%. As a decimal integer it is 16776960.

Last reviewed by Arielton Oberek.