Maaz Zindani

Loading the index…

↑↓ move↵ openesc close3993 pages

Free tool · Developer tools

Hex to RGB converter

Type a color in any common form and get it back as HEX, RGB, HSL, HSV and CMYK, with a swatch and a Copy button for every format. It works in both directions, including 8-digit HEX with transparency.

  • Free
  • No sign-up
  • Runs in your browser

By Maaz Zindani · Updated

Works both ways: type #FF5733, #f80, #FF573380, rgb(255, 87, 51), 255 87 51 or hsl(11, 100%, 60%).

Converted color

rgb(255, 87, 51)#FF5733

  • Red 255
  • Green 87
  • Blue 51
  • Alpha 1
  • HEX#FF5733
  • RGBrgb(255, 87, 51)
  • HSLhsl(11, 100%, 60%)
  • HSVhsv(11, 80%, 100%)
  • CMYK (rough)cmyk(0%, 66%, 80%, 0%)
  • RGB, modern CSSrgb(255 87 51)

Contrast: 3.15:1 with white text, 6.66:1 with black text. CMYK here is the simple screen formula, not a printer profile.

How to use the HEX to RGB Converter

  1. Type or paste a color into HEX, RGB or HSL color, for example #FF5733, rgb(255, 87, 51) or hsl(11, 100%, 60%). You can also use the Pick swatch.
  2. Read the large answer and the swatch, which is drawn over a light and a dark background so transparency is visible.
  3. Press Copy next to the format you need: HEX, 8-digit HEX, RGB, HSL, HSV, CMYK or the modern space-separated CSS form.
  4. To go the other way, type RGB or HSL values into the same box and copy the HEX.

How do I convert hex to RGB?

A six-digit HEX color is three pairs of hexadecimal digits: red, green and blue. Each pair is a number from 00 to FF, which is 0 to 255 in decimal. To convert, turn each pair into decimal: the first digit times 16 plus the second digit. For #FF5733, FF is 15 × 16 + 15 = 255, 57 is 5 × 16 + 7 = 87, and 33 is 3 × 16 + 3 = 51. So #FF5733 is rgb(255, 87, 51). This page does that sum for you and shows the same color as HSL, HSV and CMYK too.

Going back is the reverse: write each of the three numbers in base 16 and join them, padding to two digits. 51 is 33 in hex, so rgb(51, 102, 153) becomes #336699. If you need to convert single values in other bases, the number base converter handles binary, octal, decimal and hex.

What do 3, 4 and 8 digit hex colors mean?

A three-digit HEX color is shorthand: each digit is doubled, so #F80 means #FF8800, which is rgb(255, 136, 0). Shorthand only works when every pair has two equal digits, which is why #FF5733 has no short form. The page shows a short form only when one exists.

Four and eight digits add an alpha (opacity) channel at the end. #00000080 is black with an alpha byte of 80 in hex, which is 128 out of 255, about 0.5. The converter reads it as rgba(0, 0, 0, 0.5). In the other direction, an RGBA color gives the 8-digit form: alpha 0.5 becomes 128, which is 80. Alpha is rounded to two decimals for display, so 128 ÷ 255 shows as 0.5. Five and seven digit HEX values do not exist, and the page says so instead of guessing.

RGB and HSL strings are read in both the older comma form, rgb(255, 87, 51), and the modern space form, rgb(255 87 51 / 50%). Percent channels such as rgb(100%, 0%, 0%) work too, and a bare 255, 87, 51 is read as RGB.

What is the difference between RGB, HSL, HSV and CMYK?

RGB describes how much red, green and blue light a screen mixes, each from 0 to 255. HSL describes the same color as a hue angle on the color wheel (0 to 360), a saturation percent and a lightness percent. It is easier to reason about: raising lightness makes a color paler without changing its hue. For #FF5733 the hue is 11 degrees (a red-orange), saturation 100% and lightness 60%, so hsl(11, 100%, 60%). HSV, also called HSB, uses value (the brightness of the strongest channel) instead of lightness, which is how many color pickers work: hsv(11, 80%, 100%).

CMYK is the cyan, magenta, yellow and black ink model used in print. The CMYK shown here comes from the simple formula that subtracts each channel from 1 and takes out the black, so it is only a rough guide. A real print job uses an ink profile, and the numbers from a printer can differ. HSL values are rounded to whole numbers, so converting HSL back can land one step away from the original HEX: hsl(11, 100%, 60%) comes back as #FF5833, not #FF5733. HEX and RGB are exact in both directions.

Under the swatch, the page also shows the contrast ratio of the color against white and black text, using the WCAG relative luminance formula. A ratio of 4.5:1 or more is the usual target for body text. Use it as a quick check, not a replacement for testing your real design. For more colors from one source, the image color palette extractor pulls a palette from a photo.

Common colors, converted by this tool
ColorHEXRGBHSL (hue, saturation %, lightness %)
Black#0000000, 0, 00, 0%, 0%
White#FFFFFF255, 255, 2550, 0%, 100%
Red#FF0000255, 0, 00, 100%, 50%
Lime#00FF000, 255, 0120, 100%, 50%
Blue#0000FF0, 0, 255240, 100%, 50%
Yellow#FFFF00255, 255, 060, 100%, 50%
Cyan#00FFFF0, 255, 255180, 100%, 50%
Magenta#FF00FF255, 0, 255300, 100%, 50%
Orange#FFA500255, 165, 039, 100%, 50%
Purple#800080128, 0, 128300, 100%, 25%
Gray#808080128, 128, 1280, 0%, 50%
Coral#FF7F50255, 127, 8016, 100%, 66%

Every row above is produced by the same functions that run in the converter, so you can paste any HEX from the table to check it.

How do I use these values in CSS?

All four notations are valid in a stylesheet: color: #FF5733;, color: rgb(255, 87, 51);, color: hsl(11, 100%, 60%); and the 8-digit #FF573380 for a translucent text or background. HEX is compact and common in design tools. RGB is handy when a script computes channels. HSL is the best choice when you want to build a set of shades by changing only the lightness. If your sizes are in pixels and you want relative units next, the px to rem converter is a companion.

Use it with

Questions

How do I convert hex to RGB?

Split the HEX into three pairs, then turn each pair into decimal. For #FF5733 that gives FF = 255, 57 = 87 and 33 = 51, so rgb(255, 87, 51).

What does #FF5733 equal in RGB?

rgb(255, 87, 51). In HSL it is hsl(11, 100%, 60%) and in HSV hsv(11, 80%, 100%).

How do I write hex with transparency?

Add two more digits for alpha to a 6-digit HEX, giving 8 digits. Alpha 00 is fully transparent and FF is opaque; 80 is about 50%, so black at 50% is #00000080. The 4-digit form #0008 is the shorthand.

What is the difference between RGB, HSL and CMYK?

RGB mixes red, green and blue light and suits screens. HSL describes hue, saturation and lightness, which is easier to adjust by hand. CMYK is the ink model for print, and the CMYK here is a simple formula, not a printer profile.

How do I convert RGB back to hex?

Type the RGB values into the same box, for example rgb(51, 102, 153), and copy the HEX. Each number becomes two hexadecimal digits: 51 is 33, 102 is 66 and 153 is 99, giving #336699.

Is anything I type sent to a server?

No. The conversion runs in your browser and nothing you enter leaves your device.

How this page was made: the tool's results are computed in your browser by the code on this page; the explanations were drafted with AI help and checked against the tool's own output.