Skip to content
everylittletool

HEX to RGB Converter

Convert a HEX colour code to RGB and HSL, or edit any value to convert the other way.

Runs in your browser — nothing is uploaded

HEX

RGB

0–255

0–255

0–255

HSL

0–360°

0–100%

0–100%

#2F6FDE

HEX → RGB

rgb(47, 111, 222)

How to use HEX to RGB Converter

  1. 1

    Type a hex code such as #2F6FDE or #F80 into the HEX field.

  2. 2

    Read the Red, Green and Blue values and the HSL values below; they update as you type.

  3. 3

    Or edit any RGB or HSL number to convert back to HEX.

  4. 4

    Click Copy HEX, Copy RGB or Copy HSL to copy that value in CSS format.

About this tool

A hex colour code is three bytes written in base 16: two digits each for red, green and blue. To convert by hand, split #2F6FDE into 2F, 6F and DE and convert each pair: 2F is 2 × 16 + 15 = 47, 6F is 6 × 16 + 15 = 111, and DE is 13 × 16 + 14 = 222, giving rgb(47, 111, 222). Three-digit codes are shorthand where each digit is doubled, so #F80 means #FF8800.

HSL is calculated from the RGB values: hue is the angle on the colour wheel (0° red, 120° green, 240° blue), saturation is how vivid the colour is and lightness runs from 0% black to 100% white. HSL values are rounded to whole numbers, so converting HSL back to HEX can occasionally land one step away from the original hex code.

All three fields are linked, so you can start from whichever format you have. If a value is incomplete or out of range, the swatch keeps showing the last valid colour until you finish typing. Nothing is uploaded.

Questions people ask

How do I convert HEX to RGB?

Split the six digits into three pairs and convert each pair from base 16 to base 10. For example, #FF8800 becomes rgb(255, 136, 0).

What does a 3-digit hex code mean?

It is shorthand where each digit is repeated: #F80 is the same as #FF8800 and #ABC is #AABBCC.

Does this support transparency (alpha)?

No. It converts solid colours only. For 8-digit hex codes, remove the last two digits (the alpha) before converting.

Are hex codes case-sensitive?

No. #2f6fde and #2F6FDE are the same colour. CSS and design tools accept either.

Similar shortcuts