How do I convert hex to RGB?
- Paste or type a colour. Hex with or without the #, in 3, 4, 6 or 8 digits, or an
rgb(),rgba()orhsl()value. Plain numbers like239, 70, 111work too. - Or pick one. Use the colour picker, or type R, G and B values from 0 to 255 to convert RGB to hex.
- Set the opacity. Drag the alpha slider to get RGBA, HSLA and 8-digit hex values.
- Copy the format you need. Every row has a Copy button: hex for design tools, rgb() or hsl() for CSS, 0–1 values for code, and ready-made SwiftUI and Compose colours.
How does hex to RGB conversion work?
A hex colour is three pairs of hexadecimal digits: red, green and blue. Each pair runs from 00 (0) to FF (255). To convert, read each pair as a base-16 number:
| Channel | Hex pair | Sum | Decimal |
|---|---|---|---|
| Red | EF | 14 × 16 + 15 | 239 |
| Green | 46 | 4 × 16 + 6 | 70 |
| Blue | 6F | 6 × 16 + 15 | 111 |
So #EF466F is rgb(239, 70, 111). RGB to hex is the same in reverse: divide each value by 16 for the first digit and keep the remainder for the second. The CSS colour formats are defined in the W3C CSS Color Module Level 4; MDN has a friendly guide to the hex colour syntax.
Who is it for?
- Web designers and developers moving colours between Figma (hex) and CSS (rgb, hsl or a transparent rgba).
- iOS and Android developers who need a brand colour as SwiftUI
Color(red:green:blue:)or ComposeColor(0xAARRGGBB). - Brand and marketing teams filling in a style guide that lists every colour as hex, RGB and HSL.
- Anyone checking accessibility: the contrast panel shows how readable the colour is on white and black.
Building a whole scheme? Try the colour palette generator, then preview it on a real screen with the app colour preview.
Which colour formats are supported?
| Format | Example | Where it is used |
|---|---|---|
| 3 or 6-digit hex | #F46, #EF466F | Design tools, CSS, brand guides |
| 4 or 8-digit hex | #EF466F80 | CSS with transparency (the last pair is alpha) |
| RGB / RGBA | rgba(239, 70, 111, 0.5) | CSS, canvas, most design tools |
| Modern CSS | rgb(239 70 111 / 50%) | CSS Color Level 4 space-separated syntax |
| HSL / HSLA | hsl(345, 84%, 61%) | CSS, easy to make lighter or darker variants |
| 0–1 values | 0.937, 0.275, 0.435 | Shaders, Unity, Figma plugins, many SDKs |
| SwiftUI | Color(red: 0.937, green: 0.275, blue: 0.435) | iOS and macOS apps |
| Jetpack Compose | Color(0xFFEF466F) | Android apps (alpha first, then RGB) |
Common colour names such as red or rebeccapurple are understood as input too. HSL values are rounded to whole numbers, so converting HSL back to hex can differ by one or two in a channel.
Tips and common mistakes
- 8-digit hex puts alpha last in CSS (
#RRGGBBAA) but Android and Compose put it first (0xAARRGGBB). Mixing them up is a classic bug; the tool shows both. - Hex is not case-sensitive.
#ef466fand#EF466Fare the same colour. - Use HSL to make tints and shades. Keep the hue and saturation, change the lightness, and your hover and pressed states stay on-brand.
- Check contrast before you ship. A brand pink can look great as a button but fail as body text on white. Aim for at least 4.5:1 for normal text (WCAG 2.2, contrast minimum).
Related guides
- How hex colour codes work (and how to read one)Read #RRGGBB like a designer
- Hex colour with opacity: 8-digit hex codes explainedThe alpha table for #RRGGBBAA, 0 to 100%
- HSL vs RGB vs hex: which colour format should you use?Same colours, different jobs
- SVG to PNG converterTurn SVG files into sharp PNGs at 1x to 4x or any exact size
- ICO converterPNG, JPG or SVG to a multi-size ICO file and a full favicon set
- Aspect ratio calculatorFind the ratio of any size and work out the missing width or height
FAQ
How do I convert hex to RGB?
Split the hex code into three pairs and convert each from base 16 to a number from 0 to 255. #EF466F becomes 239, 70 and 111, or rgb(239, 70, 111). The converter does this instantly.
How do I convert RGB to hex?
Type the R, G and B values into the RGB to hex fields, or paste rgb(…) into the main box. The tool shows the hex code, such as #EF466F, ready to copy.
What is RGBA in hex?
It is an 8-digit hex code where the last two digits are the alpha (opacity). For example rgba(239, 70, 111, 0.5) is #EF466F80, because 50% of 255 rounds to 128, which is 80 in hex.
How do I convert hex to HSL?
Paste the hex code and copy the HSL row. #EF466F is hsl(345, 84%, 61%): a hue of 345 degrees, 84% saturation and 61% lightness.
Is it color or colour?
Both are right. Colour is the Australian and British spelling and color is American. CSS and most code always use color, so the tool accepts either kind of person.
Does the converter work offline?
Once the page has loaded, the conversion runs entirely in your browser, so it keeps working without a connection. Nothing you type is sent anywhere.
Ask AI about the hex to RGB colour converter
Opens your assistant with a question about this tool, answered from this page. You can edit it before you send.
Last updated 16 November 2026. Made by Sanket Singh at Digital Sauce in Melbourne. Found a bug or want a feature? Email development@digitalsauce.io.