Web & Developer Utilities100% Client-Side

RGB and RGBA to HEX Color Converter

Paste red, green, and blue channel values to get a hexadecimal color you can use in a stylesheet or token file. You can enter comma-separated numbers or a CSS-style RGB function. Add an opacity from zero to one to include an alpha byte in the result. The output shows uppercase and lowercase spellings so you can choose a format that matches the rest of your project without changing the color.

Input
17 chars•1 lines
Output

Reverse tool

HEX to RGB Converter

Convert 3-, 4-, 6-, or 8-digit HEX colors to CSS RGB or RGBA. Read separate red, green, blue, and alpha values for stylesheets, design tokens, and debugging.

Open HEX to RGB Converter

How to Use the RGB to HEX Converter Online

  1. 1Enter three whole numbers from 0 to 255 in red, green, and blue order. You can paste a function such as rgb(12, 160, 90) or enter the values directly.
  2. 2If you need opacity, add a fourth value from 0 to 1 using decimal notation. Use a leading zero for fractions such as 0.5.
  3. 3Check the resulting color. Three channels give six hexadecimal digits, and the optional opacity adds a fourth pair at the end.
  4. 4Copy the uppercase or lowercase result and try it in the expected CSS rule or design token field.

Input & Output Examples

Each decimal channel becomes a hexadecimal pair. The red channel is padded to two digits.

Input Sample
rgb(12, 160, 90)
Expected Output
#0CA05A
Lowercase: #0ca05a

The three color pairs are followed by 80, the nearest alpha byte to 50 percent opacity.

Input Sample
rgba(51, 102, 153, 0.5)
Expected Output
#33669980
Lowercase: #33669980

Practical Developer Workflows

  • Turn RGB values reported by design tooling into the HEX notation used by a repository’s design tokens.
  • Prepare a semitransparent HEX value for a component that accepts eight-digit colors in its configuration.
  • Normalize a list of individual swatches to one spelling by copying the uppercase or lowercase result for each color.

Zero Server Uploads & Complete Privacy

Runs 100% in your browser; no data is uploaded to any server.

Notice a bug, calculation error, or outdated info?

Let us know directly so our engineering team can fix it.

Frequently Asked Questions

Enter whole red, green, and blue values from 0 to 255. For alpha, use a number from 0 to 1. Stick to decimal numbers in channel order and include a leading zero before a fractional opacity. Percentage colors require conversion first.

Explore Other Tools

12 suggested tools

View all tools