# HEX to RGB

> Convert any HEX color code to its RGB and HSL equivalents.

URL: https://uttir.com/hex-to-rgb
Categories: color-tools
Privacy: Conversion runs locally in your browser.

## About

HEX codes like #4f46e5 are shorthand for RGB values. This converter expands any 3- or 6-digit HEX code into its rgb() and hsl() CSS equivalents, with a live preview swatch.

Invalid input is flagged immediately so you never copy a broken value into your stylesheet.

## How to use

1. **Enter a HEX code** — With or without the leading #, 3 or 6 digits.
2. **Copy RGB or HSL** — Both formats appear with copy buttons.

## Examples

### Shorthand expands

#f80 expands to the same color as #ff8800.

Input:

```
#f80
```

Output:

```
rgb(255, 136, 0)
```

## FAQ

### Do 3-digit codes work?

Yes. Each digit is doubled: #f80 equals #ff8800.

### How do I add transparency?

Use the 8-digit HEX form (#RRGGBBAA) where the last two digits are the alpha (00 = transparent, FF = opaque). Or convert to RGBA, which has an explicit alpha channel.

### What is the difference between hex and RGB?

They are the same color, just written differently. Hex is a compact base-16 shorthand (#RRGGBB) and RGB is the three component values (red, green, blue, each 0-255). Use whichever your code or design tool prefers.

### Does the tool support 8-digit hex (with alpha)?

Yes. An 8-digit hex like #FF8800CC is converted to rgba(255, 136, 0, 0.8). The alpha is converted to a 0–1 range for CSS use.

## Related tools

- [RGB to HEX](https://uttir.com/rgb-to-hex) — Convert RGB values (0–255) into a HEX color code.
- [Color Picker](https://uttir.com/color-picker) — Pick any color and copy it as HEX, RGB, or HSL.

---

For the full HTML page with the live tool, visit https://uttir.com/hex-to-rgb.
This file is the markdown rendering at https://uttir.com/hex-to-rgb.md. See https://uttir.com/llms.txt for a site-wide summary.
