Skip to content

RGB to Hex

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

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

Convert each of the three numbers (0 to 255) to a two-digit base-16 number and join them after a #. For rgb(32, 178, 170): 32 = 20, 178 = B2, 170 = AA, giving #20B2AA.

Paste them as rgb(50%, 20%, 80%) and the converter scales them to 0-255 first. Values outside the range are clipped to 0 or 255.

No. Every tool runs in your browser, so the colors you enter and any image you open are processed on your device and are not sent to our server or stored. Reloading or closing the page clears them.

Yes. Every tool is free with no sign-up and no limits on use. Clearly labeled ads keep it that way.

Yes. Colors and color codes aren't owned by anyone, so you can use anything you make here in personal and commercial projects. Brand colors may still be protected as part of a trademark.