Spincrus

Tools › HEX to RGB Color Converter

HEX to RGB Color Converter

Free online color converter: turn HEX into RGB and HSL, or RGB and HSL back into HEX. Paste any CSS color and copy the format you need.

Runs in your browser. Nothing is uploaded.

Use it from code

The same function is available as an API endpoint. Free tier: 200 calls per day without a key. Pro lifts the limit.

curl -X POST https://spincrus.uz/api/v1/tools/color-converter \
  -H "content-type: application/json" \
  -H "x-api-key: YOUR_KEY" \
  -d '{"color":"#1e90ff"}'

FAQ

How do I convert HEX to RGB?

Split the six hex digits into three pairs and read each pair as a base-16 number. For #1e90ff that gives 1e = 30, 90 = 144 and ff = 255, so the color is rgb(30, 144, 255).

Does the converter accept short HEX codes like #fff?

Yes. A three-digit code is expanded by doubling each digit, so #f80 becomes #ff8800. The leading # is optional.

Why do I get slightly different values when converting back and forth?

HSL values are rounded to whole numbers, so converting HEX to HSL and back can shift a channel by one step. HEX and RGB convert in both directions without any loss.

Related tools