Skip to content

RGB to Hex

Turn red, green and blue values into a hex code.

  • 100% Free
  • No Sign Up
  • Works in Your Browser

How to use the rGB to hex

Three steps, all in your browser.

  1. 1

    Enter a color

    Type or paste a code in any format, or use the picker.

  2. 2

    See every format

    The converted values update as you type, in every format at once.

  3. 3

    Copy the codes

    Copy any color code in one click, or share the page link.

RGB to Hex: what to know

RGB to Hex turns red, green and blue values from 0 to 255 into a six-digit hex code. Each value is written as a two-digit base-16 number and the three are joined after a #: rgb(32, 178, 170) becomes 20, B2 and AA, or #20B2AA, the CSS color lightseagreen.

You can type the three numbers or paste a CSS rgb() or rgba() value. Percentages are scaled to 0-255 first, and an alpha value adds a fourth pair to the hex code, from 00 for transparent to FF for opaque.

Hex codes are the most widely accepted color format, in CSS, HTML, design tools and brand guides, which is why they're the usual way to share a color even though RGB holds exactly the same information.

Popular uses

  • Copying a color from a tool that shows RGB into CSS
  • Writing brand guides with a single shareable code
  • Converting colors from code or a screen reading into hex
  • Shortening rgb() values in stylesheets

Tips for the best result

  • Values above 255 or below 0 aren't valid; they're clipped to the nearest edge.
  • When all three pairs repeat a digit (like #FF00CC), the short form #F0C works too.
  • Keep alpha separate if your design tool doesn't understand eight-digit hex codes.

Read how JustYourPalette works, browse named colors and curated palettes, and see our privacy details. Colors you enter and images you open are processed in your browser and are never sent to our server.

Frequently asked questions