InputTestHub

RGB to HEX Converter

Converts RGB and RGBA values into HEX colour codes, including 8-digit hex with alpha.

Colour & Design Nothing uploaded No sign-up Free, unlimited
Colour & Design tool
Pick a colour to see every value.
In short Going from RGB to HEX means writing each channel as two hexadecimal digits: rgb(58, 123, 213) becomes #3A7BD5. Every value from 0 to 255 has exactly one two-digit representation, so nothing is lost or rounded in either direction. Two details cause most of the errors. Alpha in hex is a fourth pair on the END — rgba(58, 123, 213, 0.5) is #3A7BD580, because 0.5 of 255 is 128, which is 80 in hex. People frequently write the alpha first, following the way some other formats do it, and get a completely different colour. And alpha in hex runs 00 to FF rather than 0 to 1, so a half-transparent colour is not #3A7BD50.5 or #3A7BD550. The other thing worth knowing is that shorthand only exists when both digits of every pair match: #FF0000 can be written #F00, but #FE0000 cannot be shortened at all. If a tool hands you a three-digit code for a colour that is not exactly representable, it has rounded your colour rather than abbreviated it, and the difference is visible on large areas.

How to use the RGB to HEX Converter

  1. Pick a colour with the picker or paste a HEX, RGB or HSL value.
  2. Every other format and the generated variations update instantly.
  3. Click any value or swatch to copy it.

About the RGB to HEX Converter

The RGB to HEX Converter converts RGB and RGBA values into HEX colour codes, including 8-digit hex with alpha. It runs as plain JavaScript inside the page, which means there is no upload step, no queue and no size limit imposed by a server — the only limit is your own device.

What people use it for

  • Turning a picked RGB value into a hex code.
  • Converting values from a design tool.
  • Standardising colour formats in a stylesheet.

Frequently asked questions

Are there any usage caps on the RGB to HEX Converter?
There is no cost and no cap. The RGB to HEX Converter is not a demo of a paid product, so nothing is held back or watermarked.
Does anything I enter leave my computer?
No. The RGB to HEX Converter runs entirely in your browser using JavaScript. Because the work happens locally, the tool also keeps working if your connection drops, and closing the tab is all it takes to discard everything.
Give me a worked example.
Enter rgb(27, 77, 255) and the RGB to HEX Converter returns #1b4dff.
What do people use the RGB to HEX Converter for most?
Typical uses: turning a picked RGB value into a hex code. Converting values from a design tool. Standardising colour formats in a stylesheet. It is built for exactly those cases rather than being a general-purpose tool with this bolted on.
Is there an app version?
Yes. The page is responsive and the tool works in Chrome, Safari, Firefox, Edge and Samsung Internet on both Android and iOS. There is no app to install and nothing to sign into.

Related colour & design tools

All 33
01

Colour Code Converter

Converts colours between HEX, RGB, RGBA, HSL, HSLA, HSV, CMYK, LAB and named CSS colours.

02

Colour Picker

Picks any colour and shows its HEX, RGB, HSL, HSV, CMYK and LAB values, plus tints, shades and…

03

HEX to RGB Converter

Converts HEX colour codes to RGB and RGBA values, handling 3, 4, 6 and 8 digit hex.

04

HSL Colour Converter

Converts between HSL, HEX and RGB, so you can adjust lightness and saturation predictably.

05

CMYK Colour Converter

Converts between CMYK and RGB or HEX for print work, with a note on gamut differences.

08

Colour Contrast Checker

Calculates WCAG contrast ratio between two colours and reports AA and AAA pass or fail for…

10

Tailwind Colour Converter

Finds the nearest Tailwind colour class for any hex value, and shows the hex for any Tailwind…