RGB to HEX
Enter R, G, B values (0–255) and instantly get the 6-digit HEX colour code. Useful when a colour picker or API returns integer channel values and you need the hex string for CSS, SVG, or HTML.
Last updated: May 28, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is RGB to HEX?
RGB and HEX represent the same colour in different formats. RGB expresses channels as integers from 0–255; HEX encodes those integers as two hexadecimal digits per channel, prefixed with #.
Converting RGB to HEX is needed when working with Canvas APIs, colour pickers that return integer tuples, accessibility tools that output RGB, or any system where a library produces RGB but your stylesheet expects hex.
How to Use RGB to HEX
Enter the Red, Green, and Blue values (0–255 each)
The HEX code appears instantly
Copy with the copy button
Common Use Cases
- Frontend developers converting Canvas API colour values to hex for CSS variables.
- Designers translating RGB values from image editors into CSS-compatible hex codes.
- Developers reading colour outputs from accessibility or contrast checkers that return RGB.
- Anyone converting between colour formats in a design-to-code workflow.
Example Input and Output
Converting the RGB value of Tailwind blue-500 to its HEX equivalent.
R: 59, G: 130, B: 246#3B82F6Reverse direction
To convert HEX back to RGB, use the HEX to RGB tool.
Browser-side only
Conversion runs locally in your browser.

