Skip to content
Tools

Color converter

Convert colors between HEX, RGB, and HSL.

#3B82F6

rgb(59, 130, 246)

RGB

HSL

All formats

HEX
#3B82F6
RGB
rgb(59, 130, 246)
HSL
hsl(217, 91%, 60%)

About the Color converter

Convert a color between HEX, RGB and HSL, with a live preview. Use it when a design gives you a color in one format and your CSS needs another, or to adjust a color by hue or by a single channel.

How to use it

  1. Enter a six-digit code in HEX, or choose a color with the color picker next to it.
  2. Or set R, G, B (0-255) or H (0-360), S, L (0-100%) with the fields or sliders.
  3. The other formats update as you go. Select Copy next to a format to copy it as CSS, such as rgb(59, 130, 246) or hsl(217, 91%, 60%).
  4. Random picks a color; Reset returns to #3B82F6.

Supported formats

HEX input must be six digits; three-digit shorthand such as #fff and alpha values are not converted. HSL values are rounded to whole numbers, so editing HSL can move the RGB values slightly from where they started.

Runs in your browser

All conversions happen in the page, and no request is made to a server.

Questions

How do I convert HEX to RGB?
Split the six digits into three pairs and read each pair as a base-16 number from 0 to 255. For #3B82F6, 3B is 59, 82 is 130 and F6 is 246, which gives rgb(59, 130, 246).
What is the difference between RGB and HSL?
RGB sets the amount of red, green and blue light, each from 0 to 255. HSL describes the same colors as a hue angle from 0 to 360 degrees plus saturation and lightness percentages, which makes it easier to lighten a color without changing its hue.
Is #fff the same as #ffffff?
Yes. In CSS a three-digit HEX code doubles each digit, so #fff is #ffffff and #3b8 is #33bb88. This converter needs the six-digit form.