# HEX to RGB Converter

> A HEX to RGB converter translates a colour between the two notations CSS accepts - #2563eb and rgb(37, 99, 235) describe exactly the same colour. This one also returns HSL and the contrast ratio against white and black, which is what accessibility checks need.

Source: https://rankcert.com/tools/hex-to-rgb
Free, no signup. Updated: 2026-09-02

## How to use it

1. Enter a HEX value such as #2563eb, or three numbers from 0 to 255.
2. Read the RGB, HSL and preview swatch.
3. Check the contrast ratios if the colour will carry text.

## Questions

### How do I convert HEX to RGB by hand?

Split the six digits into three pairs and read each as base 16. 25 is 37, 63 is 99, eb is 235.

### What does the third pair of a hex colour mean?

Blue. The six digits are red, green and blue, two hex digits each, giving 256 levels per channel and 16.7 million colours.

### What is an eight-digit hex colour?

The last pair is alpha - opacity from 00 to ff. #2563eb80 is that blue at roughly 50% opacity.

### When is HSL more useful than HEX?

When building a palette. Keeping hue and saturation fixed and varying only lightness gives consistent tints and shades, which is nearly impossible to do by eye in HEX.

### What contrast ratio do I need?

4.5:1 for body text and 3:1 for large text or UI components, under WCAG AA. AAA asks for 7:1, which is difficult with brand colours.

### Do three-digit hex codes work?

Yes. #f00 expands to #ff0000 - each digit is doubled. It only reaches 4,096 colours, so it is a shorthand for simple values.

### Why does my colour look different in a design tool?

Colour profile. Design tools often work in Display P3 or Adobe RGB; the web is sRGB. The hex value is the same but the rendered result differs.

### Is RGB the same as RGBA?

RGBA adds an alpha channel from 0 to 1. Modern CSS also accepts rgb(37 99 235 / 50%), which does the same thing.

## Related tools

- [Image Color Picker](https://rankcert.com/tools/image-color-picker): Click anywhere on an image to read the exact colour as HEX, RGB and HSL, and keep a palette of everything you picked. Nothing is uploaded.
- [PNG to PDF](https://rankcert.com/tools/png-to-pdf): Turn a PNG, JPG or screenshot into a PDF in your browser. No upload, no signup, no watermark - the file never leaves your device.
- [PDF to PNG](https://rankcert.com/tools/pdf-to-png): Render every page of a PDF as a high-resolution PNG in your browser. Nothing is uploaded, there is no page limit and there is no watermark.
- [PNG to JPG](https://rankcert.com/tools/png-to-jpg): Convert a PNG to JPG in your browser with a quality slider, and see exactly how much smaller the result is before you download it.
- [JPG to PNG](https://rankcert.com/tools/jpg-to-png): Convert a JPG to lossless PNG in your browser, ready for editing, transparency work or any tool that refuses JPEG.
- [Color Mixer](https://rankcert.com/tools/color-mixer): Mix paint colours and see the result instantly. Answers what colours make brown, green, orange and purple using real subtractive mixing, not screen colours.