Hex ↔ RGB Converter

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

Independently verified for accuracy

Calculator by Toolsloft ↗
Enter a color to convert

This tool converts a HEX color code to its RGB values and converts RGB back to HEX, in both directions. Use it when you have a color in one notation and need the other for CSS, design files, or code.

How this is calculated

Hex to RGB expands 3-digit shorthand to 6 digits and parses each pair as a base-16 byte into red, green, and blue; RGB to HEX reads three numbers and writes each as a two-digit hex value, rejecting any component outside 0 to 255.

How to use

  1. Enter a hex code (e.g. #ff8800) or RGB values (e.g. 255, 136, 0).
  2. Pick the conversion direction.
  3. Copy the converted color.

Examples

  • Hex → RGB: #ff8800 → rgb(255, 136, 0)
  • RGB → Hex: 255, 136, 0 → #ff8800

FAQ

Do you support 3-digit hex codes?
Yes. Shorthand like #fff is expanded to #ffffff before converting.
What RGB formats are accepted?
Any input with three numbers works, "rgb(255, 136, 0)", "255, 136, 0", or "255 136 0" all convert.
Why did my conversion fail?
Hex must be 3 or 6 valid hex digits, and RGB values must be three numbers from 0 to 255.

Embed this calculator

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