HEX to RGB Converter
HEX, RGB and HSL in one place — plus the contrast verdict.
In
Out
How HEX to RGB Converter works
HEX is parsed to red/green/blue bytes (0–255) — #1f4a3f is R 31, G 74, B 63. RGB can be edited directly and the hex updates in sync, so both directions work.
HSL is derived and shown alongside because it is the space where design changes are easy: keep the hue, nudge lightness, get a consistent shade.
Relative luminance (0.299R + 0.587G + 0.114B, weighted for human perception) decides the verdict: above ~0.6 needs dark text, below needs white — the WCAG starting point.
Worked example
#1f4a3f reads RGB(31, 74, 63), HSL(165°, 41%, 21%) with luminance 0.235 — far below 0.6, so white text on top is the correct pairing. The swatch demonstrates it live in the corner.
The tool above opens with these numbers. Change them to run your own scenario, or press Reset to come back to this example.
Frequently asked questions
Related tools
Craft smooth, multi-layer elevation shadows with CSS and Tailwind code.
Convert raw SVG vectors into background-image CSS and Base64 data URIs.
Generate modern CSS clamp() formulas for smooth fluid typography and spacing.
Four harmony systems from one base colour — click to copy.
Frame the shot — numeric crop with a live selection overlay.
Generate multi-size favicons and preview them in browser tab mockups.
- hex to rgb
- color converter
- hsl
- css
- design