---
title: "HEX to RGB Converter - Free Online Tool | CanDoYa"
description: "Free HEX to RGB converter. Type a hex color code like #ff5733 and get the rgb() value, a live color preview and one-click copy - right in your browser."
url: https://candoya.com/tools/hex-to-rgb/
locale: en
type: browser-tool
---

# HEX to RGB Converter

Category: Color & Design

## How do I convert HEX to RGB?

A hex color is three pairs of hexadecimal digits, one pair per channel. Convert each pair to a decimal number from 0 to 255: in #ff5733, ff is 255 red, 57 is 87 green and 33 is 51 blue, so the RGB value is rgb(255, 87, 51). This converter does that instantly as you type.

The converter accepts every CSS hex form: 6-digit `#ff5733`, 3-digit shorthand `#f53`, and the 4- and 8-digit forms with an alpha channel, with or without the `#`. It shows the `rgb()` or `rgba()` string, the plain channel values and a per-channel breakdown - and a reverse RGB to HEX row when you need to go the other way. **Everything runs in your browser** - no upload, no account, no limits.

## How to use it

1. **Enter a hex code** - Type or paste a hex color like #ff5733 (or #f53), or pick one with the color swatch. The # is optional.
2. **Read the RGB value** - The rgb() string, the plain 0-255 values and a live color preview update as you type, with a per-channel breakdown showing how each hex pair converts.
3. **Copy the format you need** - Click Copy next to the rgb() string or the raw values. Need the reverse? Enter red, green and blue below to get the hex code back.

## Who it's for

- **Front-end developers** turning a hex code from a style guide into rgb() so they can add opacity with rgba().
- **Designers** moving brand colors between tools that want hex (CSS, Figma) and tools that want 0-255 values (some print and video apps).
- **Email and marketing teams** matching campaign colors across editors that only accept one notation.
- **Game and app developers** feeding 0-255 channel values into engines and SDKs that don't parse hex strings.

## Expert note

For 8-digit hex the alpha byte is not 0-255 in CSS: rgba() wants 0-1, so the converter divides by 255 and rounds to three decimals - #ff573380 becomes rgba(255, 87, 51, 0.502), not alpha 128. Tools that print 0.5 are rounding away precision.

## Frequently asked questions

### Is this HEX to RGB converter free?

Yes - it's 100% free with no sign-up and no limits. It runs entirely in your browser.

### Are my colors uploaded anywhere?

No. The conversion is plain JavaScript running on your device - nothing is sent to a server, and it keeps working offline once the page is loaded.

### What is the formula to convert HEX to RGB?

Split the hex code into three pairs and convert each pair from base 16 to decimal: multiply the first digit by 16 and add the second (a=10 ... f=15). In #ff5733, ff = 15x16+15 = 255, 57 = 5x16+7 = 87, 33 = 3x16+3 = 51.

### Does it support 3-digit shorthand like #f53?

Yes. In CSS shorthand each digit is doubled, so #f53 expands to #ff5533 and converts to rgb(255, 85, 51). The 4-digit form works the same way, with the last digit as alpha.

### How does it convert HEX to RGBA?

An 8-digit hex code carries alpha in its last pair. That byte (0-255) is divided by 255 to get the 0-1 alpha rgba() expects, rounded to three decimals - so #ff573380 becomes rgba(255, 87, 51, 0.502).

### Can it convert RGB back to HEX?

Yes. Use the RGB to HEX row under the result: enter red, green and blue values from 0 to 255 and it returns the hex code instantly. Out-of-range values are clamped to 0-255.

### Why do I need rgb() instead of hex?

Mostly for alpha and for math: rgba(255, 87, 51, 0.5) makes a color translucent, and many APIs, game engines and design specs expect separate 0-255 channel numbers rather than a hex string.

## Related tools

- [Color Contrast Checker](https://candoya.com/tools/color-contrast-checker/)
- [SVG Pattern Generator](https://candoya.com/tools/svg-pattern-maker/)
- [RGB to HEX Converter](https://candoya.com/tools/rgb-to-hex/)
- [HEX to HSL Converter](https://candoya.com/tools/hex-to-hsl/)
- [Color Picker](https://candoya.com/tools/color-picker/)

---

*Markdown edition of <https://candoya.com/tools/hex-to-rgb/>, published for AI agents and other automated readers. Index of key pages: <https://candoya.com/llms.txt>.*
