RGB to HEX
Paste rgb(31, 95, 214) — with commas or spaces, it does not matter — and get #1f5fd6, ready for CSS, a design file or a style guide.
- #1f5fd6 HEX
- rgb(31, 95, 214) RGB
- hsl(219, 75%, 48%) HSL
Contrast:
- Free
- Files never leave your device
- No sign-up
- No file limit
How to use
- Paste the RGB or RGBA value, or pick a colour with the swatch.
- Read the HEX code above the other formats.
- Press «Copy» next to the HEX line.
Good to know
Why designers ask for HEX
HEX is one token instead of three numbers, which makes it easy to paste into a spec, a ticket or a chat message without losing a digit. It is also the notation that design tools show by default, so a palette written in HEX matches what everyone else is looking at.
What happens to the alpha channel
If you pass rgba() with transparency, the result is an eight-digit HEX: the last pair encodes alpha from 0 to 255. Modern browsers read it correctly; older ones do not, so keep rgba() where you need broad support.
Frequently asked questions
Do I have to write rgb(...) around the numbers?
The full notation with commas or spaces is accepted, in both rgb() and rgba() form. Values above 255 are clamped rather than silently wrapped.
Why is my HEX eight characters long?
Because the colour has an alpha channel. Drop the transparency and you get the usual six-digit code.
Is anything sent to a server?
No. The whole conversion happens in the page, so unpublished brand colours stay with you.
Related tools
- Colour Converter Type a colour in any common notation — #1f5fd6, 1f5fd6, #1f5, rgb(31, 95, 214) — and all the ot…
- HEX to RGB Paste a HEX code and read the RGB channels. #1f5fd6 becomes rgb(31, 95, 214) — and if the code…
- Password Generator A new password is generated the moment this page loads, using your browser's cryptographic rand…
- Colour Palette Generator Pick a starting colour and the tool works out the rest of the set by the colour wheel. Click an…
- CSS Gradient Generator Drag the sliders and watch the panel above change with them. When it looks right, copy the line…
- Box Shadow Generator Move the sliders and the sample changes with them. Stack layers when one shadow is not enough —…
- Colour Picker Move across the square to pick a colour, or take one that already exists: from a picture with t…