RGB ↔ Hex Converter

Switch between RGB and Hex color codes instantly, copy either result and view a live preview of the shade.

RGB to Hex

Enter red, green and blue channel values (0–255) to generate the matching Hex code.

Each channel must be a whole number between 0 and 255.

Hex to RGB

Paste a 3- or 6-digit Hex color to see the RGB representation.

Use #RRGGBB or #RGB format. Letters are case-insensitive.

Why use RGB?

RGB expresses colors as light intensity values for red, green and blue. It is the native format for screens, LEDs and most design software.

When you need to tweak contrast, accessibility or gradients, editing individual RGB channels gives precise control.

Why use Hex?

Hex compresses the three RGB channels into a compact six-character code that is easy to paste into CSS, design tokens and code snippets.

The format travels well between tools and keeps colors readable for designers and developers alike.

Convert colors manually

Follow these steps to switch between RGB and Hex without a calculator.

  • Write each RGB channel as a number between 0 and 255.
  • Divide the value by 16. The quotient is the first hex digit, the remainder is the second digit.
  • Map values 10–15 to the letters A–F and join the three pairs to form #RRGGBB.

To go from Hex to RGB, split the string into pairs, convert each pair from base 16 to base 10 and reuse the resulting decimals.