HEX to RGB: #008000

Also known as: CSS green

Result

#008000 → rgb(0 128 0)

Values are shown at full precision, so converting back gives exactly #008000. The rounded form is what you normally paste into CSS.

Step-by-step math

Every number below is computed from the input, nothing is looked up.

  1. 1. HEX → pairs

    #008000 → 00 | 80 | 00
  2. 2. base 16 → base 10

    R = 00₁₆ = 0×16 + 0 = 0
    G = 80₁₆ = 8×16 + 0 = 128
    B = 00₁₆ = 0×16 + 0 = 0
  3. 3. RGB

    rgb(0 128 0)

All formats

HEX
#008000
RGB
rgb(0 128 0)
RGB (legacy)
rgb(0, 128, 0)
HSL
hsl(120.00 100.00% 25.10%) → hsl(120 100% 25%)
HWB
hwb(120 0% 50%)
OKLCH
oklch(0.520 0.177 142.5) · oklch(52.0% 0.177 142.5)
OKLab
oklab(0.520 -0.140 0.108)
Lab (D50)
lab(46.28 -47.55 48.59)
LCH (D50)
lch(46.28 67.98 134.38)
Display P3
color(display-p3 0.2160 0.4942 0.1315)
Linear sRGB
color(srgb-linear 0.0000 0.2159 0.0000)

Gamut: sRGB and Display P3

#008000 is a hex color, so it sits inside sRGB and therefore inside Display P3. At this lightness and hue, sRGB reaches chroma 0.177 and Display P3 reaches 0.208; this color uses 100% of the sRGB chroma available.

CSS snippets

.element {
  color: #008000;
  color: rgb(0 128 0);
  color: hsl(120 100% 25%);
  color: oklch(0.520 0.177 142.5);
}

/* Tailwind CSS v4 */
@theme {
  --color-brand: oklch(0.520 0.177 142.5);
}
/* arbitrary values */
class="text-[#008000] bg-[oklch(0.520_0.177_142.5)]"

/* wide-gamut screens */
@media (color-gamut: p3) {
  .element { color: color(display-p3 0.2160 0.4942 0.1315); }
}

/* relative color syntax: 10% darker */
.element-dark { color: oklch(from #008000 calc(l - 0.1) c h); }

Nearby colors

Closest colors in the Tailwind and CSS named palettes (OKLab distance).

Lighter and darker, same hue and chroma

  • #259321 · oklch(0.580 0.177 142.5) · ΔL +0.06
  • #006E00 · oklch(0.460 0.177 142.5) · ΔL −0.06

Open in the studio

Other converters for this color

All converters →

Guides: What is OKLCH?