HEX to RGB converter

Enter a HEX code, with or without the #, and get RGB values for CSS, code and screen design tools.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter hex code.
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

Each pair of HEX digits is read as a base-16 number: R = RR, G = GG, B = BB, from 0 to 255; a 3-digit code doubles each digit. Then: The channels are rounded to whole numbers from 0 to 255.

Example

Inputs: HEX code = #1E90FF. Result: RGB code: rgb(30, 144, 255); Red (R): 30; Green (G): 144.

#1E90FF
rgb(30, 144, 255)

Limits and caveats

  • Transparency (#RRGGBBAA or #RGBA) is not read; enter the 6 or 3 digit color part.
  • All values are treated as sRGB, the default web color space, not Display P3 or Adobe RGB.

Questions about this tool

How do I convert HEX to RGB by hand?

Turn each pair of base-16 digits into a decimal number: in #1E90FF, 1E = 30, 90 = 144 and FF = 255.

Does it accept 3-digit codes like #0AF?

Yes. A 3-digit code is expanded by doubling each digit, so #0AF becomes #00AAFF. The # is optional.

Why are the RGB values whole numbers?

Each channel of a standard 8-bit screen color has 256 levels, 0 to 255, so the result is rounded to the nearest whole number.