Free No sign-up Client-side

RGB to HEX Converter

Type three RGB channel values and get the matching hexadecimal colour code for CSS and HTML — an exact, reversible swap that describes the very same on-screen colour.

RGBHEX
#00C9D1
InputRGB
OutputHEX

HEX

#00C9D1

HEX (no hash)

00C9D1

What does RGB to HEX conversion do?

RGB and HEX are two notations for describing exactly the same colour on a screen. RGB lists the red, green and blue channels as three numbers from 0 to 255; a HEX code packs those same three numbers into a six-digit hexadecimal string written as #RRGGBB. Converting from one to the other simply re-writes the numbers in a different base — the colour your monitor paints does not shift in the slightest.

Each channel value is turned into a two-character hexadecimal pair: 255 becomes FF, 112 becomes 70, and 0 becomes 00. Because every value from 0–255 maps to exactly one pair (and back), the conversion is perfectly reversible — paste the HEX into our HEX to RGB converter and you'll recover the original numbers.

HEX codes are the most common way to write colours in CSS, HTML and design files because they're compact and unambiguous, which is why front-end developers reach for this conversion constantly.

How to convert RGB to HEX

  1. 1

    Enter your RGB values

    Type the red, green and blue channels, each a whole number from 0 to 255.

  2. 2

    Read the HEX code

    The #RRGGBB code updates instantly, alongside a swatch so you can see the colour.

  3. 3

    Copy it into your project

    Use the copy button and drop the code straight into your CSS, HTML, or design tool.

Why convert RGB to HEX

Cleaner CSS

A single #0070DC is shorter and tidier than rgb(0, 112, 220) when you don't need an alpha channel.

Designer-friendly

Most design apps and brand guidelines quote colours as HEX, so this is the format teammates expect.

Exact, not approximate

Every RGB triplet maps to one specific HEX code — there's no rounding or guesswork involved.

Private and instant

Conversion runs in your browser as you type; nothing is uploaded anywhere.

Worked example

A standard blue, written as RGB on the left and its HEX equivalent on the right.

RGB → HEX
rgb(0, 112, 220)
#0070DC

How a channel becomes two hex digits

Hexadecimal is base-16, so a single hex digit covers 0–15 and two digits cover 0–255 — exactly the range of one RGB channel. To convert a channel, divide by 16 for the first digit and take the remainder for the second, using AF for 10–15. For example green 112 is 7×16 + 0, giving 70. Concatenating the three pairs in red-green-blue order produces the final code.

Common RGB values and their HEX codes

  • rgb(255, 255, 255) is pure white → #FFFFFF.
  • rgb(0, 0, 0) is pure black → #000000.
  • rgb(255, 0, 0) is full red → #FF0000.
  • rgb(0, 112, 220) is a typical link blue → #0070DC.

Frequently asked questions

Yes. Each RGB channel from 0–255 maps to exactly one two-digit hex pair, so the colour is preserved perfectly with no rounding. The HEX code describes the identical on-screen colour.

Absolutely. The conversion is fully reversible — paste the HEX code into a HEX to RGB tool and you'll recover the same red, green and blue numbers you started with.

#FFF is a CSS shorthand that expands each digit, so #FFF means #FFFFFF (white). Shorthand only works when each channel's two digits are identical. This tool outputs the full six-digit form for clarity.

Both are valid — #0070dc and #0070DC are the same colour. Uppercase is common in design tools while lowercase is common in CSS; pick whichever your team prefers.

This converter handles the standard red, green and blue channels. For transparency you'd use an 8-digit #RRGGBBAA hex or the rgba() function, where the extra value encodes opacity.

Yes. Paste the hex directly into a Tailwind theme extension under colors, or assign it as a CSS custom property like --color-brand: #0070DC. Both accept standard #RRGGBB notation without any conversion.

Need another tool?

Browse the full toolbox or dig into the blog for the engineering behind it.

Call UsWhatsApp