Search calculators

Search all calculators or type # to filter by category

DeveloperLive results

Hex ↔ RGB Color

Convert between hex color codes and RGB values.

Formula

#RRGGBB ↔ rgb(r, g, b)

How to use

  1. 1Pick the direction (Hex to RGB or RGB to Hex).
  2. 2Enter the hex code or the RGB values.
  3. 3Read the hex, RGB and HSL forms of the color.

About this calculator

Web colors travel in three notations: compact hex codes like #3BD5FF, RGB triplets like rgb(59, 213, 255), and HSL, which humans read more easily. This converter moves between all three in either direction, so whatever format a color arrives in, you get the one you need.

Formula explained

#RRGGBB packs red, green and blue as three two-character hex pairs, each 0 to 255 - the same range RGB uses as decimals. Hex to RGB reads each pair as a number; RGB to hex writes each channel as two hex digits. HSL uses hue 0 to 360 degrees and saturation and lightness 0 to 100%.

Worked example

3B = 59, D5 = 213, FF = 255, so #3BD5FF = rgb(59, 213, 255) ≈ hsl(195, 100%, 62%), a bright sky blue.

Tips & notes

  • Keep hex codes six digits unless deliberately using the three-digit shorthand.
  • For related shades, convert to HSL and vary only the lightness.
  • Check text-to-background contrast rather than judging color by eye.

Frequently asked questions