JavaScript canvas, styled-components, and React inline styles need RGB numbers — not hex strings. Get the exact R, G, B values in one step.

Design tools like Figma, Sketch, and Adobe XD export colors as HEX codes. But the moment you move that color into JavaScript, you often need RGB. The HTML5 Canvas API uses ctx.fillStyle = 'rgb(255, 87, 51)' or requires separate R, G, B values when blending. React inline styles accept backgroundColor: 'rgb(59, 130, 246)' but not always HEX shorthand reliably across environments.
CSS-in-JS libraries like styled-components and Emotion let you build dynamic styles in JavaScript — and color manipulation functions like rgba(${r}, ${g}, ${b}, 0.5) require decimal channel values, not hex strings. Stripe's brand blue (#635BFF), Shopify's green (#96BF48), or GitHub's dark (#24292E) all need to be parsed to RGB before you can programmatically adjust opacity or mix colors.
Chrome DevTools color picker shows both HEX and RGB — knowing how to read both speeds up debugging. WCAG contrast ratio calculations also require RGB luminance, making this conversion a routine step in accessibility audits.
All calculations run locally in your browser — nothing is sent to any server.
fillStyle and color blending functions require numeric R, G, B — convert Figma HEX exports in one step.rgba(${r}, ${g}, ${b}, 0.5).HEX uses base-16: each pair of digits (00–FF) converts to decimal 0–255. #FF5733: FF=255 (red), 57=87 (green), 33=51 (blue).
Shorthand HEX: #F53 expands to #FF5533. Each digit is doubled.
To convert RGB to HEX: convert each decimal channel to 2-digit hexadecimal. rgb(255, 87, 51) → FF, 57, 33 → #FF5733.
| Feature | HEX | RGB |
|---|---|---|
| Format | #RRGGBB | rgb(R, G, B) |
| Values | 00–FF (hex) | 0–255 (decimal) |
| Opacity | 8-digit (#RRGGBBAA) | rgba(R, G, B, A) |
| Shorthand | #RGB (3 digits) | No shorthand |
| Used in | CSS, design tools | CSS, programming |
Split the HEX code into three pairs and convert each from base-16 to decimal. #FF5733: FF=255 (red), 57=87 (green), 33=51 (blue) → rgb(255, 87, 51). Each pair ranges from 00 (0) to FF (255).
Use ctx.fillStyle = 'rgb(255, 87, 51)' or template literal syntax: ctx.fillStyle = `rgb(${r}, ${g}, ${b})`. The Canvas API accepts both rgb() strings and rgba() for transparency. Convert your design's HEX exports to RGB before passing them to canvas functions.
Use CSS rgba(): rgba(255, 87, 51, 0.5) for 50% opacity. Alternatively, use 8-digit HEX: #FF573380 where 80 is hex for 128 (≈50% opacity). In CSS variables: --brand-alpha: rgba(255, 87, 51, 0.15) is a common pattern for overlay states.
3-digit HEX doubles each digit: #F53 expands to #FF5533. It only applies when each channel pair has identical digits (#RRGGBB where R0=R1, G0=G1, B0=B1). Tailwind's slate-900 (#0F172A) cannot be shortened; white (#FFFFFF) becomes #FFF.
Chrome DevTools color picker lets you toggle between HEX, RGB, HSL, and HWB. RGB is displayed as a cross-reference — useful when JavaScript code needs numeric channels or when debugging CSS-in-JS computed styles that output rgb() values.
#000000 = rgb(0, 0, 0) = pure black. All channels at minimum. #FFFFFF = rgb(255, 255, 255) = pure white. All channels at maximum. These are useful anchor points when building tonal scales or testing contrast.
No. All HEX to RGB conversions run entirely in your browser. Nothing is transmitted to any server. The tool works offline once the page has loaded.

Have an idea, found a bug, or want to suggest a feature? Drop us a message – we respond within 24 hours.