Hex to RGB Converter

Convert HEX color codes to RGB values. Supports 3- and 6-digit hex. Free, instant, and private.

Independently verified for accuracy

Calculator by Toolsloft ↗
Enter a hex code to convert

This tool converts a HEX color code to its RGB values for use in CSS, design files, or code. It accepts both 6-digit codes and 3-digit shorthand, with or without the leading hash. Paste a hex value and copy the rgb() result.

How this is calculated

Three-digit shorthand is expanded to six digits, then each pair of hex characters is read as a base-16 byte for red, green, and blue. Anything that is not three or six valid hex digits is rejected.

How to use

  1. Enter a hex color code, for example #3366cc or #abc.
  2. The RGB value appears below as you type.
  3. Copy the rgb() result into your CSS or code.

Examples

  • #3366cc: rgb(51, 102, 204)
  • #abc (shorthand): rgb(170, 187, 204)

FAQ

Do you support 3-digit hex codes?
Yes. Shorthand like #abc is expanded to #aabbcc before converting, which is the same rule browsers use.
Is the leading hash required?
No. Both #3366cc and 3366cc work. The hash is stripped before parsing.
Why did my conversion fail?
The value must be exactly three or six hexadecimal digits (0 to 9 and a to f). Other characters or lengths are rejected.

Embed this calculator

Add this free calculator to your own site. Copy the code and paste it where you want it to appear.