About HEX to RGB Conversion
HEX and RGB are two ways of writing the same colour. A HEX code like #2563EB encodes three colour channels as pairs of hexadecimal digits. An RGB value like rgb(37, 99, 235) encodes those same three channels as decimal numbers from 0 to 255. The colour is identical — only the notation differs.
Design tools, brand guidelines and copy-pasted code snippets tend to mix both formats. This converter lets you move between them instantly, along with the other common colour formats you'll encounter.
How HEX to RGB conversion works
A six-digit HEX code is three pairs of hexadecimal digits, in the order R, G, B. Each pair ranges from 00 (0) to FF (255). To convert, read each pair as a base-16 number and write the result in base-10.
| HEX digits | Channel | Hex → Decimal | RGB value |
|---|---|---|---|
| 25 | Red | 2×16 + 5 = 37 | 37 |
| 63 | Green | 6×16 + 3 = 99 | 99 |
| EB | Blue | 14×16 + 11 = 235 | 235 |
So #2563EB becomes rgb(37, 99, 235). The process is fully reversible and lossless — every HEX code maps to exactly one RGB triplet and vice versa.
Reference values
| Colour | HEX | RGB |
|---|---|---|
| Black | #000000 | rgb(0, 0, 0) |
| White | #FFFFFF | rgb(255, 255, 255) |
| Red | #FF0000 | rgb(255, 0, 0) |
| Green | #00FF00 | rgb(0, 255, 0) |
| Blue | #0000FF | rgb(0, 0, 255) |
| Mid grey | #808080 | rgb(128, 128, 128) |
3-digit shorthand
CSS also supports a 3-digit shorthand where each digit is doubled. #F0C is exactly the same as #FF00CC. This converter expands shorthand automatically, so #F0C and #ff00cc both work.
When to use HEX vs RGB
- HEX — compact, easy to copy, and the default in design tools (Figma, Sketch, Photoshop). Best for static colours in CSS and design specifications.
- RGB — easy to manipulate in code, especially when you need to adjust one channel. Best for JavaScript, Canvas, WebGL and animated colour transitions.
- HSL — even easier for adjusting hue, saturation and lightness by hand. Best for theming systems and dark-mode variants.
- CMYK — the print standard. Use it for anything destined for a printer, packaging or a physical product.
Common use cases
CSS in JS
Convert design tokens from HEX to RGB for runtime manipulation.
Canvas & WebGL
Graphics APIs expect RGB or normalized channel values.
Batch processing
Convert an entire palette or design system at once.
Print preparation
Get CMYK equivalents from source brand hex codes.
Accessibility
Compute channel values for contrast calculations.
Documentation
Produce colour specs in the format each team needs.
Privacy and accuracy
This HEX to RGB converter runs entirely in your browser. All conversions happen locally in JavaScript with no server calls. The colour codes you enter are never transmitted, stored or logged.