Skip to content
Devtools 360

Convert RGB Colours to HEX Codes

Paste colour values copied from CSS, design tools or DevTools and get HEX codes back. Legacy rgba(255, 0, 0, 0.5), modern rgb(255 0 0 / 50%), percentages and bare numbers all work.

No data leaves this pageFree · No sign-up

How to convert RGB to HEX

  1. Paste rgb() or rgba() values into the input, one per line. Bare channels such as "244 63 94" also work.
  2. Choose lowercase, uppercase or shortest HEX output.
  3. Keep alpha to get 8-digit #rrggbbaa codes for translucent colours, or untick it to drop transparency.
  4. Copy the converted list or download it as a text file.

Benefits

  • Accepts every rgb() syntax variant browsers understand, including percentages.
  • Optional shortest form outputs #0af instead of #00aaff where that is lossless.
  • Clear per-line errors explain what is wrong, such as a missing channel or mixed syntax.

Limitations

  • Fractional channel values are rounded to the nearest integer, since HEX can only store whole numbers 0–255.
  • Channels above 255 or below 0 are clamped rather than rejected, matching browser behaviour.

Privacy and security

Values are converted in this page with plain JavaScript; nothing is sent anywhere or saved.

Read our privacy policy for details about the site as a whole.

Frequently asked questions

Can I mix commas and the slash alpha syntax?

No. CSS treats rgb(255, 0, 0 / 0.5) as invalid, so this tool reports it. Use either rgba(255, 0, 0, 0.5) or rgb(255 0 0 / 0.5).

Why does my 8-digit HEX look different in some apps?

Most browsers support #rrggbbaa, but some older design tools and email clients expect alpha first (#aarrggbb) or ignore it entirely. Untick "Keep alpha" if the destination doesn't support transparency.

What does 50% mean in rgb(100% 50% 0%)?

Each percentage is a share of 255, so 50% becomes 127.5, which rounds to 128 (hex 80).