HEX to RGB Converter
#FF5733rgb(255, 87, 51)Overview
Convert color codes both ways
Convert color codes between HEX and RGB in both directions. Supports alpha (RGBA and 8-digit HEX), CSS4 space syntax, and one-click copy. Everything runs in your browser.
Getting started
How to Convert a Color
- 1 Enter a HEX code
Type or paste a HEX value into the HEX field, with or without the # prefix. The RGB value and channel inputs update as you type.
- 2 Or enter an RGB value
Type an RGB value into the RGB field using rgb(), rgba(), CSS4 space syntax, or bare comma-separated channels. The HEX value updates instantly.
- 3 Fine-tune with channels
Adjust the R, G, and B channel fields (0–255) or the A field (0–1) to tweak the color directly. Both HEX and RGB outputs follow along.
- 4 Set the output format
Toggle uppercase HEX or CSS4 space syntax to match your codebase, then click the copy button next to the value you need.
Reference
Common HEX ↔ RGB Values
| Color | HEX | RGB |
|---|---|---|
| Black | #000000 | rgb(0, 0, 0) |
| White | #FFFFFF | rgb(255, 255, 255) |
| Red | #FF0000 | rgb(255, 0, 0) |
| Green | #008000 | rgb(0, 128, 0) |
| Blue | #0000FF | rgb(0, 0, 255) |
| Tomato | #FF6347 | rgb(255, 99, 71) |
| DodgerBlue | #1E90FF | rgb(30, 144, 255) |
| Gold | #FFD700 | rgb(255, 215, 0) |
| HotPink | #FF69B4 | rgb(255, 105, 180) |
| SlateGray | #708090 | rgb(112, 128, 144) |
| Teal | #008080 | rgb(0, 128, 128) |
| Crimson | #DC143C | rgb(220, 20, 60) |
Good to know
Tips and Common Mistakes
-
Shorthand HEX doubles each digit
#F53 expands to #FF5533, not #F05030. Each of the three digits is repeated, so #FFF and #FFFFFF are the same white.
-
Alpha lives in the last pair
In 8-digit HEX (#RRGGBBAA) the final two digits set opacity: 00 is fully transparent, FF is fully opaque, 80 is roughly 50%.
-
CSS4 uses spaces, not commas
Modern rgb(255 87 51 / 0.5) separates channels with spaces and the alpha with a slash. Older browsers need the legacy rgb(255, 87, 51) form.
-
RGB channels stop at 255
Each channel is a whole number from 0 to 255. Values above 255 or with decimals are out of range and will not convert.