WebToolsPlanet
Converter Tools

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

Client-Side Processing
Input Data Stays on Device
Instant Local Execution

Find this tool useful? Support the project to keep it free!

Buy me a coffee

What 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

1

Enter the Red, Green, and Blue values (0–255 each)

2

The HEX code appears instantly

3

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.

RGB input
R: 59, G: 130, B: 246
HEX output
#3B82F6

Reverse direction

To convert HEX back to RGB, use the HEX to RGB tool.

Browser-side only

Conversion runs locally in your browser.

Frequently Asked Questions

What range do R, G, B values accept?
0 to 255 inclusive. Values outside this range are clamped.
Does the output include the # prefix?
Yes — the output is always in #RRGGBB format.
Is my data sent to a server?
No. All conversion runs in your browser.