Hex to RGB Converter
Convert hex colors to RGB and HSL (and back from rgb() values) in your browser. Supports 3-8 digit hex and alpha. Free, instant.
About this tool
Convert a hex color code to its RGB and HSL equivalents, with channel values broken out for quick copying. All hex forms work: #f43, #34d399, and 8-digit hex with alpha, with or without the leading #.
It converts the other way too: paste rgb(52, 211, 153) or an rgba() value and the report includes the hex form, so moving colors between CSS, design tools, and code is one paste in either direction.
Common uses
- Translate a brand hex code into rgb() or hsl() for a stylesheet.
- Get the numeric channel values a canvas or chart library expects.
- Convert an rgba() value from devtools back into 8-digit hex.
Automate via API
The same conversion is available as a REST endpoint for scripts, pipelines, and backends:
curl -X POST https://payloadly.com/api/v1/tools/hex-to-rgb \ -H "Content-Type: text/plain" \ -H "X-Api-Key: YOUR_API_KEY" \ --data-binary @input.txt
Worked examples
Real payloads from tools people use daily, with the exact output this converter produces. Every example runs in your browser, so you can load one and adapt it to your own data.
Convert a brand hex to rgb() for CSS opacity tricks
Older CSS patterns need the raw channel numbers to build rgba(r, g, b, 0.5) overlays from a brand color.
#10b981
Hex #10b981 RGB rgb(16, 185, 129) HSL hsl(160, 84%, 39%) Channels R 16 G 185 B 129
Hex notes
Hexadecimal (base 16) uses the digits 0-9 and a-f, so one hex digit represents exactly four bits. It is the standard notation for memory addresses, byte dumps, color codes, and hashes.
- Hex values are case-insensitive; 0xFF and 0xff are the same number.
- A leading 0x prefix is a convention, not part of the value.
- Each hex digit maps to exactly one 4-bit nibble, which is why hex-binary conversion is mechanical.
Frequently asked questions
Is my data uploaded to a server?
No. This tool runs entirely in your browser using JavaScript, and there are no ads on the page. Nothing you paste or drop here is uploaded, logged, or stored, and you can verify that yourself: open your browser's developer tools and watch the Network tab while you convert (no requests leave the page), or disconnect from the internet after the page loads and keep working.
How does hex map to RGB?
A 6-digit hex color is three bytes: two hex digits per channel in red, green, blue order. #34d399 is 0x34 red (52), 0xd3 green (211), 0x99 blue (153). Shorthand #f43 doubles each digit (#ff4433), and digits 7-8 are the alpha channel.
When should I use HSL instead of RGB?
HSL (hue, saturation, lightness) is easier to reason about when adjusting a color: darken by lowering lightness, mute by lowering saturation, keep the same hue. RGB and hex describe the same colors; HSL just organizes them along human-friendly axes.
Is there a size limit or a fee?
The browser tool is free with no signup and comfortably handles files up to tens of megabytes (limited by your device's memory). For automated or bulk processing inside your own scripts and pipelines, use the paid REST API.
Related tools
Convert hex, decimal, binary, and octal in one place, in your browser. Auto-detects the input base, handles huge numbers. Free, no upload.
Decode hex to ASCII/UTF-8 text in your browser. Handles 0x, \x, colons and spaces between bytes. Free, private, nothing uploaded.
Encode text to hex bytes in your browser with full UTF-8 support. Space-separated pairs, ready for code or protocols. Free, instant.
Convert Unix timestamps to dates and back in your browser. Auto-detects seconds vs milliseconds, shows ISO 8601, UTC, relative time.