1. Home
  2. Color
  3. Color Code Converter

Color Code Converter

Convert colors between HEX, RGB, HSL and OKLCH with a live preview.

For every format and option in one place, use Color Tools →

Runs in your browser · No upload
Paste a color in any format: HEX, RGB, HSL, HSV, CMYK or OKLCH.
 

Detected: HEX

The color in every format
FormatValueCopy
HEX#ff5b1f
RGBrgb(255, 91, 31)
HSLhsl(16, 100%, 56%)
HSV (HSB)hsv(16, 88%, 100%)
CMYKcmyk(0%, 64%, 88%, 0%)
OKLCHoklch(68.35% 0.21 37.96)
Contrast on white
3.1:1
Contrast on black
6.77:1
Best text color
Black

How to use

  1. Paste a color into the box | #ff5b1f, rgb(255, 91, 31), hsl(16 100% 56%), oklch(68% 0.21 38) and other formats are detected automatically.
  2. Or click Pick a color to choose one with your browser’s color picker.
  3. The table lists the color in six formats, each with its own Copy button.
  4. The preview text switches between black and white, whichever reads better, and the contrast ratios are shown below.

Color formats compared

Format Example Used for
HEX #ff5b1f the most common notation on the web and in design tools
RGB rgb(255, 91, 31) red, green and blue light levels on screen (0–255)
HSL hsl(16, 100%, 56%) hue, saturation, lightness | easy to make lighter or darker shades
HSV (HSB) hsv(16, 88%, 100%) the model behind many color pickers, including Photoshop’s
CMYK cmyk(0%, 64%, 88%, 0%) ink percentages for print (cyan, magenta, yellow, black)
OKLCH oklch(68.35% 0.21 37.96) a perceptually uniform space, usable in CSS as oklch()

Example

#3366cc converts to rgb(51, 102, 204), hsl(220, 60%, 50%) and cmyk(75%, 50%, 0%, 20%). Its contrast against white is about 5.4:1, enough for body text under WCAG AA (4.5:1).

Things to keep in mind

  • CMYK here is a simple formula. Real print color depends on paper, ink and the printer’s color profile, so confirm print values with your print shop.
  • Rounding HSL or HSV to whole numbers can shift a channel by one step when converted back to HEX (for example 5b → 5a). Use HEX or RGB as the source of truth when precision matters.
  • OKLCH can describe colors that ordinary sRGB screens cannot show; those are mapped to the nearest displayable color, with a note.
  • Under WCAG, body text needs at least 4.5:1 contrast and large text 3:1 for AA. To build matching color schemes, try the color palette generator.

FAQ

How do I convert HEX to RGB by hand?

Split the six digits into pairs and convert each from hexadecimal: #ff5b1f → ff = 255, 5b = 91, 1f = 31, so rgb(255, 91, 31). A three-digit code like #f53 doubles each digit: #ff5533.

Does it keep transparency?

Values with alpha, like rgba(…, 0.5), are accepted, but results show the opaque color only.

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.