Toolsy
Back to blog

Guides

Color converter: HEX, RGB, and HSL

12 min read

Design files speak hex. Stylesheets often want rgb(). Some pickers and docs also show HSL. A color converter sits in the middle so you stop translating on paper. Toolsy’s color converter turns #hex into red, green, and blue (and back) with a live swatch. It does not include HSL fields today; this article still covers why people search HSL next to hex and RGB, and how to hand off tokens without breaking contrast. After you convert, check pairs in the contrast checker.

Why format swaps block handoffs

Figma and brand PDFs default to hex. A React style prop or older snippet expects rgb(232, 80, 10). Someone retypes digits and introduces a one-off wrong channel.

Short hex (#f00) and long hex (#ff0000) both appear in code reviews. Teams argue about style while the real bug is a mistyped digit.

HSL shows up when a designer tweaks lightness without changing hue. Developers who only paste hex never see that intent unless the tool chain preserves it.

What HEX, RGB, and HSL each buy you

Hex is compact for tokens and CSS. Six digits pack three channels; three-digit forms expand by doubling each digit.

RGB matches how many graphics APIs and rgb() functions think: three 0–255 channels. Easy to copy after conversion.

HSL (hue, saturation, lightness) is friendlier for adjusting “same color, lighter.” Many design tools expose it. CSS also supports hsl() / hsla() in modern browsers. Toolsy’s converter focuses on hex ↔ RGB; treat HSL as a parallel representation you may compute in the design tool, then lock a hex/RGB pair for engineering.

Hex and RGB in daily CSS

Paste hex into the converter, copy rgb(), or edit channels to regenerate hex. Keep the # on hex pastes. Use the swatch to catch inverted channels before they hit production.

Short codes like #f00 expand correctly on this page. Prefer six-digit tokens in design systems when you want consistency in reviews.

Where HSL still matters

Use HSL inside the design tool when you explore a lightness scale for hover states. Export or note the final hex/RGB for the token file engineers consume.

If your codebase standardizes on hsl() strings, convert in the design tool or a dedicated HSL utility; do not assume Toolsy’s page emits HSL. Honesty beats a fake field.

How to prepare brand colors for conversion

Copy from the source of truth, not from a compressed screenshot. Screenshots shift colors.

Convert one token at a time when building a table: name, hex, rgb. Add HSL only if your design system stores it.

Strip alpha for this converter. Opaque hex/RGB only. Transparent overlays need a separate alpha decision in CSS.

Walkthrough in the color converter

  1. Open Color converter.
  2. Paste a hex value (with #) or edit R, G, and B fields.
  3. Watch the swatch update.
  4. Copy hex or the rgb() string with the buttons.
  5. Paste into CSS variables or a token PR.

Default brand-like values on the page are only examples. Replace them with your palette before you copy.

From design token to contrast check

Take the hex for the button label and the hex for the fill into the contrast checker. Aim for WCAG AA on real label sizes. The guide Contrast checker for WCAG AA buttons walks ratios and hover states.

Conversion without contrast is unfinished handoff. Pretty swatches still fail gray-on-peach buttons.

Gradients and multi-stop palettes

When the color feeds a hero wash, build stops in the CSS gradient maker after you lock hex values. See CSS gradient generator for hero backgrounds. Convert each stop the same way so CSS and design stay aligned.

How to check you converted the right color

Compare the swatch to the design side by side. A wrong channel often looks “almost” right until you put them together.

Round-trip: hex → RGB → hex should match (allowing short vs long hex expansion). If it drifts, you edited a channel after paste.

Have a second person read the token table. Typos survive solo reviews.

Related jobs after the numbers match

Run AA checks on buttons and links with Contrast checker for WCAG AA buttons.

Build section backgrounds with CSS gradient once tokens exist.

For share images that bake brand color into a PNG, size the file using OG image size and aspect ratio; the converter does not export images.

Limits, privacy, and non-goals

Conversion is browser-local and free. No account. No upload of your palette.

No HSL inputs or outputs on this tool today. No CMYK. No color-blind simulation. No full accessibility audit.

Do not treat a converted pair as production-ready without contrast and theme checks (light and dark).

Frequently asked questions

What does a hex to rgb converter do?

It turns a #hex color into red, green, and blue numbers you can paste into CSS, and it can go from RGB back to hex. Toolsy’s color converter also shows a live swatch so you spot mistakes early. Use it during token handoffs, not as a full design app.

Can I hex to rgb with short codes like #f00?

Yes. Three-digit hex expands to six digits before conversion. #f00 becomes the same channels as #ff0000. Prefer documenting six-digit forms in shared token files when your team wants one canonical spelling.

Does this color converter support HSL?

Not in the UI today. The page converts hex and RGB with a swatch. Adjust HSL in your design tool, then paste the resulting hex here for CSS rgb() or hex tokens. Search interest in HSL is real; the product honesty is that Toolsy focuses on hex ↔ RGB on this route.

Is this hex to rgb tool free?

Yes. No account and no daily limit. Conversion runs in your browser. Paid plans elsewhere on Toolsy do not gate this page.

Does hex to rgb upload my colors?

No. Values stay on your device. Nothing is sent to a server for this tool. Follow your company’s rules if unpublished brand palettes are restricted even on local machines.

How is hex to rgb different from a color picker?

A picker helps you choose a new color. This page converts formats you already have. Use a picker to explore; use the converter when the brand color is decided and CSS needs another spelling.

Should I check contrast after converting?

Yes. Converted numbers can still fail WCAG AA on buttons. Paste the foreground and background hex into the contrast checker and read Contrast checker for WCAG AA buttons. Fix failing pairs before merge.

What rgb() string should I copy?

Copy the full rgb(r, g, b) output from the tool when your stylesheet expects that function. Some stacks prefer separate channels in theme objects instead. Either way, confirm the three numbers match the swatch before you merge.

Can I use converted colors in gradients?

Yes. Lock hex stops, then build the wash in CSS gradient. Keep the same hex in both places so marketing and engineering argue about design, not transcription.

Why do my hex and Figma color look different on screen?

Displays, color profiles, and browser calibration differ. Start from the token value, not a screenshot. If wide-gamut vs sRGB matters for your brand, decide that in the design system; this converter stays on standard hex/RGB web values.

For AA button checks after the swap, continue with Contrast checker for WCAG AA buttons. For hero washes using those tokens, see CSS gradient generator for hero backgrounds.

Convert hex and RGB

Paste a #hex color, read RGB, or edit channels and copy hex. Live swatch. Free in your browser.

Open color converter
Share this article

More to read

Color converter: HEX, RGB, and HSL — Toolsy