RGB
#336699
rgb(51, 102, 153)
HEX
#336699
Help Us Improve
—
(—)
RGB to HEX converter
Convert RGB to HEX and hex back to RGB with live preview. Copy CSS-ready codes. Local-first—no signup.
What is an RGB to HEX converter?
RGB to HEX features
Channel sliders
Dial Red, Green, and Blue from 0–255 and see HEX update live.
HEX ↔ RGB
Edit hex or use the color picker to convert back to RGB channels.
Paste rgb()
Drop in rgb(), rgba(), or comma-separated triples for a quick convert.
Copy HEX, RGB, HSL
One-click copy for CSS and design handoffs.
How to convert RGB to HEX
Enter RGB
Use the Red, Green, and Blue sliders or paste an rgb() string.
Read HEX
The preview and HEX field show the matching #rrggbb value.
Copy what you need
Copy HEX, rgb(), or hsl() into your stylesheet or design file.
Tips for RGB and HEX
- 01
Clamp to 0–255
Out-of-range channel values are rounded into the valid byte range.
- 02
Short hex expands
Three-digit hex like #f63 becomes #ff6633 before conversion.
- 03
Sample from a photo
Grab a hex on Image Color Picker, then paste it here to inspect RGB.
- 04
Check contrast next
After converting, verify text pairs on Colour Contrast Checker.
Great for
CSS and HTML
Turn design-tool RGB into #rrggbb for stylesheets.
Design handoffs
Match Figma or Sketch RGB readouts to web hex codes.
Quick checks
Confirm two formats describe the same color before shipping.
Why convert here
Local-first
Colors never leave the browser for this tool.
Free
Unlimited conversions with no signup.
Bidirectional
RGB to HEX and HEX to RGB in one place.
Live preview
See the swatch update as you move each channel.
Technical notes
- Mapping
- Each channel 0–255 → two lowercase hex digits; combined as #rrggbb.
- Inputs
- Channel sliders, rgb()/rgba()/bare triples, and #rgb / #rrggbb.
- Outputs
- Lowercase HEX, rgb(), and hsl() strings.
- Privacy
- Client-side only—no network upload.
Sources & References
“The <hex-color> CSS data type is a notation for describing the hexadecimal color syntax of an sRGB color using its primary color components (red, green, and blue) written as hexadecimal numbers.”
MDN — <hex-color>: Defines #rrggbb (and short forms) as hexadecimal encoding of RGB channel bytes. developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/hex-color
“Hexadecimal (hex) string notation uses a hexadecimal value to represent each component (red, green, and blue) of an RGB color.”
MDN — CSS color values: Explains how hex notation maps to RGB components used by this converter. developer.mozilla.org/en-US/docs/Web/CSS/Guides/Colors/Color_values
“The sRGB color space is an RGB color space with defined chromaticities and a defined transfer function.”
W3C CSS Color Module: Defines the sRGB model behind typical web RGB and hex color values. w3.org/TR/css-color-4/