RGB to HEX

Convert RGB color values like rgb(137, 151, 187) into a HEX code (#8997BB) for CSS, HTML, design tools and brand guides. Free RGB to HEX converter.

Turn RGB values into a HEX code

Many apps show colors as RGB numbers: red, green and blue values from 0 to 255. But web code, brand guidelines and most design hand-offs use the shorter HEX form. This tool converts an RGB value such as rgb(137, 151, 187) into its HEX code, #8997BB.

Each RGB number becomes a two-digit hexadecimal pair: 137 is 89, 151 is 97 and 187 is BB. Put them together after a # and you have the HEX code.

HEX codes are easy to copy, share and paste into CSS, HTML attributes, Figma, Canva, WordPress themes and email templates.

How to use the rgb to hex

  1. Enter the RGB value, for example rgb(137, 151, 187).
  2. Submit to convert.
  3. Copy the HEX code.

Examples

Brand periwinkle

Input: rgb(137,151,187)

Output: #8997bb

The result is lowercase; HEX is case-insensitive, so #8997BB is the same color.

Spaces are fine

Input: rgb(255, 255, 255)

Output: #ffffff

Semi-transparent color

Input: rgba(137,151,187,0.5)

Output: #c4cbdd

The alpha is blended against white to give a solid color, which is lighter than #8997bb. For true transparency, keep rgba() or use eight-digit HEX.

Common uses

  • Converting colors picked in apps that show RGB into web-ready HEX.
  • Writing brand style guides that list HEX codes.
  • Setting theme colors in website builders and CMS settings.
  • Sharing exact colors with designers and developers.
  • Copying a color from an app that shows RGB, such as a screenshot tool, into CSS or a design file.
  • Filling in brand guidelines, which usually list colors as HEX.
  • Matching a color from a print or office document on a website.

Tips and things to know

  • Each RGB value must be between 0 and 255.
  • HEX codes are not case-sensitive: #8997bb and #8997BB are the same color.
  • If your color has transparency, use the color converter to get eight-digit HEX or RGBA.
  • Pick a color visually with the color picker, or convert back with HEX to RGB.

Edge cases and limitations

  • The value must start with rgb or rgba. Just typing 137, 151, 187 isn't recognized.
  • Values above 255, such as rgb(300,0,0), are rejected.
  • Percentages like rgb(50%, 50%, 50%) aren't supported; convert them to 0–255 first.
  • Modern space-separated syntax, rgb(137 151 187), may not be recognized; use commas.

Frequently asked questions

How do I convert RGB to HEX?

Convert each of the three values (0–255) to a two-digit hexadecimal number and join them after a #. For example 255, 128, 0 becomes #FF8000.

What is white in HEX?

#FFFFFF, which is rgb(255, 255, 255).

Can I use RGB directly in CSS?

Yes. CSS accepts rgb() and rgba() as well as HEX, so use whichever you prefer.

What does a short HEX code like #FA0 mean?

It's shorthand where each digit is doubled: #FA0 equals #FFAA00.

Why is my HEX lowercase?

The converter writes lowercase letters. #8997bb and #8997BB are exactly the same color, so either works in CSS and design tools.

Related tools

  • HEX to RGB: Easily convert HEX color units to RGB with this easy convertor.
  • Color converter: Convert your color to multiple other formats.
  • Color picker: The easiest way to select a color from the color wheel and get the results in any format.
  • Hex converter: Convert text to hexadecimal and the other way for any string input.
  • Image optimizer: Compress and optimize images for a smaller image size but still high quality.

Similar tools

HEX to RGB

Convert any HEX color code like #8997BB to its RGB value, rgb(137, 151, 187), for CSS, design apps and code. Free HEX to RGB converter.

Popular free tools