← All tools

HEX, RGB and HSL converter

Type a color code to see its equivalent in the other formats at once. It runs in your browser and nothing is sent to a server.

Type HEX (#3b82f6), rgb(), hsl() or a color name (blue). Click any swatch below to select that color.

Tints and shades

Complementary color

Analogous colors

Triadic harmony

How to read a HEX code

A HEX code is six hexadecimal digits after the # sign, split into three pairs: the first pair is the amount of red, the second green and the third blue. Hexadecimal digits are 0–9 and a–f, and each pair ranges from 00 (none) to ff (255, full). So #ff0000 is pure red, #ffffff is white and #000000 is black. #3b82f6 is 3b = 59 red, 82 = 130 green and f6 = 246 blue, or rgb(59, 130, 246).

Which format goes where

HEX: the most common format in CSS, HTML, Figma, Canva and most design tools. RGB: some programs, the "More colors" dialog in Office apps and color calculations in JavaScript. HSL: the most practical format for making lighter and darker shades and for defining color variables in CSS.

For semi-transparent colors use rgba(), hsla() or 8-digit HEX (such as #3b82f680, where the last two digits are the opacity). Three-digit short HEX doubles each digit: #38f is the same as #3388ff.

Small differences in conversion

Conversion between HEX and RGB is exact, with no loss. HSL values are shown rounded to whole numbers, so converting from HSL back to RGB can be off by one unit, which is invisible to the eye. CMYK, used in print, is a different system from screen colors; giving the printer your HEX code and asking for a test print is the safest route. Calculations run in your browser.

How to use it

  1. Type the color code in the field: HEX, rgb() or hsl().
  2. The same color's HEX, RGB and HSL values appear on the right.
  3. Press the Copy button next to the format you want.

Frequently asked questions

How do you convert a HEX code to RGB?

The six digits of the HEX code are split into three pairs: the first two are red, the next two green and the last two blue. Each pair is converted from hexadecimal to decimal. For #3b82f6, 3b = 59, 82 = 130 and f6 = 246, so rgb(59, 130, 246).

What does the 3-digit short HEX mean?

Each digit is doubled: #38f is the same as #3388ff. Only colors whose pairs are identical can be written in the short form.

Can the conversion show small differences?

HSL values are shown rounded to whole numbers, so converting from HSL back to RGB can differ by one unit. The conversion between HEX and RGB is exact.

Are the colors I enter sent anywhere?

No. The calculation runs in your browser and nothing is uploaded.

Related guide

Related tools