Color converter

HEX to Rec. 2020 and Rec. 2020 to HEX

Type a HEX value or a Rec. 2020 value, and the other one appears as you type. Every other notation of the same color is listed below, with each step of the maths.

Example: #D3AF37

Example: color(rec2020 0.74174 0.66017 0.25864)

The converter needs JavaScript. The values shown are for #D3AF37, and the worked examples below read without it.

Result

Inside sRGB

HEX
#D3AF37
Rec. 2020
color(rec2020 0.74174 0.66017 0.25864)
RGB
rgb(211 175 55)
HSL
hsl(46.2 63.9% 52.2%)
OKLCH
oklch(76.55% 0.13847 91.55)

Color converters

Every format at once

The same color in every notation the converters know. Each name opens its own converter.

The color in every format
FormatValueCopy
Web and CSS
HEX CSS#D3AF37
RGB CSSrgb(211 175 55)
sRGB (0 to 1) CSScolor(srgb 0.8275 0.6863 0.2157)
Linear sRGB CSScolor(srgb-linear 0.65141 0.42869 0.0382)
HSL CSShsl(46.2 63.9% 52.2%)
HSV (HSB) Notationhsv(46.2 73.9% 82.7%)
HWB CSShwb(46.2 21.6% 17.3%)
CSS color name CSSgoldenrodNearest ΔE00 5.00
Perceptual and CIE
OKLCH CSSoklch(76.55% 0.13847 91.55)
OKLab CSSoklab(76.55% -0.00375 0.13842)
CIELAB CSSlab(73.19 4.7 62.68)
CIE LCH CSSlch(73.19 62.86 85.71)
CIE XYZ (D65) CSScolor(xyz-d65 0.42882 0.44786 0.1)
CIE XYZ (D50) CSScolor(xyz-d50 0.45463 0.45457 0.07797)
CIE xyY NotationxyY(0.43906 0.45855 0.44786)
CIELUV Notationluv(72.75 30.75 69)
Wide gamut
Display P3 CSScolor(display-p3 0.80472 0.69157 0.30739)
Rec. 2020 CSScolor(rec2020 0.74174 0.66017 0.25864)
Adobe RGB (1998) CSScolor(a98-rgb 0.78545 0.68035 0.26584)
ProPhoto RGB CSScolor(prophoto-rgb 0.67408 0.63343 0.26964)
Print and paint
CMYK Notationcmyk(0% 17.1% 73.9% 17.3%)
RAL Classic NotationRAL 1032 Broom yellowNearest ΔE00 3.02
Video
YCbCr (JPEG, BT.601) Notationycbcr(172.08 61.93 155.76)
YCbCr (HD video, BT.709) Notationycbcr709(165.43 71.67 148.64)
Code and platforms
Decimal integer Notation13872951
Android and Flutter ARGB Notation0xFFD3AF37
Android color int Notation-2904265
SwiftUI and UIKit NotationColor(red: 0.8275, green: 0.6863, blue: 0.2157)
GLSL vec3 / vec4 Notationvec3(0.8275, 0.6863, 0.2157)
Embedded and terminal
RGB565 Notation0xD567Lossy
ANSI 256 (xterm) Notation38;5;178Nearest ΔE00 3.11

Every step of the maths

How HEX becomes Rec. 2020

Each step shows the values for the color above, as the converter computes them.

  1. Start Hex digits #D3AF37
  2. Back 8-bit channels each pair of digits read as a byte 211 175 55
  3. Back sRGB channels, 0 to 1 each byte ÷ 255 0.8275 0.6863 0.2157
  4. Then Linear light c ≤ 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055)^2.4 0.65141 0.42869 0.0382
  5. Then CIE XYZ, D65 the sRGB to XYZ matrix 0.42882 0.44786 0.1
  6. Then Linear Rec. 2020 the XYZ to Rec. 2020 matrix 0.55151 0.43964 0.08262
  7. Then Rec. 2020 the Rec. 2020 transfer curve color(rec2020 0.74174 0.66017 0.25864)

Rec. 2020

About Rec. 2020

Rec. 2020 is the ITU's color space for ultra HD and HDR video, with primaries on the edge of visible color that hold far more than Display P3. CSS reads it as color(rec2020 …), with the BT.2020 transfer curve.

How this page writes it

  • Converted through XYZ with matrices built from the BT.2020 primaries and D65; the curve is linear near black and a power of 0.45 above.
  • Written to five decimal places.

Watch for

  • No current screen shows all of Rec. 2020; values near its edges are mapped by the browser.

Worked examples

HEX to Rec. 2020

Each row is the converter's own output, and a test re-runs every row.

Each example, converted
ColorHEXRec. 2020
White#FFFFFFcolor(rec2020 1 1 1)
Black#000000color(rec2020 0 0 0)
Middle gray#808080color(rec2020 0.45214 0.45214 0.45214)
Red#FF0000color(rec2020 0.79198 0.23098 0.07376)
Green#00FF00color(rec2020 0.56754 0.95928 0.26897)
Blue#0000FFcolor(rec2020 0.16837 0.05113 0.94678)
Royal blue#2563EBcolor(rec2020 0.27021 0.33265 0.86959)
Gold#D3AF37color(rec2020 0.74174 0.66017 0.25864)

Next

Related converters

Method

Sources and testing

  • Conversions run in your browser with the site's shared color code; nothing you type is sent anywhere.
  • An automated test recomputes every value on this page and reads every format back.
  • Checked with a keyboard, the axe engine and Playwright in Chromium, in light and dark themes at phone and desktop widths. It has not yet been checked with a screen reader.

Found a mistake? Tell us and we will correct it.