left-arrow-icon
RGB to Hex Converter icon

Rgb to Hex - Hex to RGB

Find the hex color and rgb color codes for different colours. Convert rgb to hex, hex to rgb, hex to hsv, hex to hsl, hex to cmyk, rbg to cmyk.

Home

Converter

RGB to Hex Converter


=
=

HEX CODE: #ffd700

copy icon

COLOUR RGB: 255, 215, 0

HSV: hsv(51, 100%, 100%)

HSL: hsl(51, 100%, 50%)

CMYK: cmyk(0%, 15.69%, 100%, 0%)

What is RGB and Hex Code?

Formula Icon
  • RGB and HEX are color models and they are used to represent colors in digital space. RGB stands for Red, Green, and Blue
  • HEX stands for hexadecimal and the colors are represented in hex format with 2 digits per color. The first two digits of a HEX color code represent the red component, the next two digits represent the green component and the last two digits represent the blue component.
  • Both HEX and RGB can represent upto 16 million colors. As R, G and B each can be expressed with a color value in the range 0 to 255, the number of unique colors possible is 255 ^ 3 which is 16 1/2 million
  • Example of an RGB color code representation is RGB(203,65,84) where R=203,G=65,B=84 which represents Brick Red color.
    Example of a HEX color code representation is #FFFF00, where first 2 digits FF is R, Next 2 digit FF is G and 00 is B and this is representation for Yellow color.
  • Both RGB and HEX are Additive. An Additive color system goes from lightness to darkness. When all 3 red, green and white color is combined, it becomes white (#FFFFFF or RGB(255,255,255)).
    By decreasing color value from each of these gradually, it becomes darker and darker till we end with black color (#000000 or RGB(0,0,0))
  • When to use RGB

  • As RGB is the color format used by monitors and digital displays, use RGB for digital images and videos
  • When creating a color palette for a website or brand, it is also generally best to use RGB. This is because RGB colors will display consistently on all devices.
  • For any print version, it is generally best to use RGB. RGB color codes are the standard color format used by printers and other print devices.
  • When to use HEX

  • When specifying colors in HTML, CSS, and other programming languages, it is generally best to use HEX. This is because HEX color codes are the most efficient way to represent colors in code.
  • If working on web content and not print, then use Hex instead of RGB as HEX is the standard color format used in HTML, CSS and web programming languages.
  • In summary, use HEX for Web based work such as HTML, CSS and other web programming. Use RGB for print, monitor, branding and non-programming areas.

Formula for rgb to hex and hex to rgb converter

Formula Icon

Find Color Hex from RGB (rgb to hex)

  • R/16=R
  • G/16=G
  • B/16=B
  • To convert RGB value as Hex (use hexdecimal number table)
  • Hex=#+R+G+B

Get RGB color code from Hex code (hex to rgb)

  • To convert Hex value as Decimal (use decimal number table)
  • take first hex value multiply by 16
  • take second hex value multiply by 16
  • add first and second value this is R value
  • take third hex value multiply by 16
  • take fourth hex value multiply by 16
  • add third and fourth value this is G value
  • take fifth hex value multiply by 16
  • take sixth hex value multiply by 16
  • add fifth and sixth value this is B value

Formula to convert HSL to RGB

  • When 0 ≤ H < 360, 0 ≤ S ≤ 1 and 0 ≤ L ≤ 1:
  • C = (1 - |2L - 1|) × S
  • X = C × (1 - |(H / 60°) mod 2 - 1|)
  • m = L - C/2
  • (R',G',B')=(C,X,0) if 0 <=H '< 1
  • (R',G ',B')=(X,C,0) if 0<=H '< 2
  • (R',G ',B')=(0,C,X) if 0<=H '< 3
  • (R',G ',B')=(0,X,C if 0<=H '< 4
  • (R',G ',B')=(X,0,C) if 0<=H '< 5
  • (R',G ',B')=(C,0,X) if 0<=H '< 6
  • (R,G,B) = ((R'+m)×255, (G '+m)×255,(B'+m)×255)

Formula to convert HSV to RGB

  • When 0 ≤ H < 360, 0 ≤ S ≤ 1 and 0 ≤ V ≤ 1:
  • C = V × S
  • X = C × (1 - |(H / 60°) mod 2 - 1|)
  • m = V-C
  • (R',G',B')=(C,X,0) if 0° <=H '< 60°
  • (R',G ',B')=(X,C,0) if 0°<=H '< 120°
  • (R',G ',B')=(0,C,X) if 0°<=H '< 180°
  • (R',G ',B')=(0,X,C if 0°<=H '< 240°
  • (R',G ',B')=(X,0,C) if 0°<=H '< 300°
  • (R',G ',B')=(C,0,X) if 0°<=H '< 360°
  • (R,G,B) = ((R'+m)×255, (G '+m)×255,(B'+m)×255)

Formula to convert CMYK to RGB

  • r= 255 *((1-c) * (1-k))
  • g= 255 *( (1-m) * (1-k))
  • b = 255 * ((1-y) * (1-k))

Note


  • RGB color code values are based on the number system we are most familiar with, the decimal number system. The decimal number system is a Base-10 system, meaning there are 10 unique characters used to define the numbers. The 10 characters used are the numbers 0 – 9
  • Hex color code values, in comparison, are based on the hexadecimal number system. The hexadecimal number system is a Base-16 system, meaning there are 16 unique characters used to define the numbers. The 16 characters used are the numbers 0 – 9, and the letters A – F
  • Number system 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 for decimal
  • Number system 0 1 2 3 4 5 6 7 8 9 A B C D E F for hexdecimal

Color Hex and RGB Color Codes for key colours

Conversion icon
Color Codes Hex code colour RGB color code CMYK Preview
Red color code #FF0000 RGB(255, 0, 0) cmyk(0%,100%,100%,0%)
Pink color code #FFC0CB RGB(255, 192, 203) cmyk(0%,25%,20%,0%)
Orange color code #FFA500 RGB(255, 165, 0) cmyk(0%,35%,100%,0%)
Yellow color code #FFFF00 RGB(255, 255, 0) cmyk(0%,0%,100%,0%)
Green color code #008000 RGB(0, 128, 0) cmyk(100%,0%,100%,50%)
Blue color code #0000FF RGB(0, 0, 255) cmyk(100%,100%,0%,0%)
Brown color code #A52A2A RGB(165, 42, 42) cmyk(0%,75%,75%,35%)
White color code #FFFFFF RGB(255, 255, 255) cmyk(0%,0%,0%,0%)
Gray color code #808080 RGB(128, 128, 128) cmyk(0%,0%,0%,50%)
Gold color code #FFD700 RGB(255, 215, 0) cmyk(0%,16%,100%,0%)
Purple color code #800080 RGB(128, 0, 128) cmyk(0%,100%,0%,50%)
Orange color code #FFA500 RGB(255, 165, 0) cmyk(0%,35%,100%,0%)
Sage Green color code #B2AC88 RGB(178, 172, 136) cmyk(0%,3%,24%,30%)
Teal color code #008080 RGB(0, 128, 128) cmyk(100%,0%,0%,50%)
Lavender color code #E6E6FA RGB(230, 230, 250) cmyk(8%,8%,0%,2%)
Light Blue color code #ADD8E6 RGB(173, 216, 230) cmyk(25%,6%,0%,10%)
Beige color code #F5F5DC RGB(245, 245, 220) cmyk(0%,0%,10%,4%)
Hot Pink color code #FF69B4 RGB(255, 105, 180) cmyk(0%,59%,29%,0%)
Cyan color code #00FFFF RGB(0, 255, 255) cmyk(100%,0%,0%,0%)
Maroon color code #800000 RGB(128, 0, 0) cmyk(0%,100%,100%,50%)
Navy Blue color code #000080 RGB(0, 0, 128) cmyk(100%,100%,0%,50%)
Royal Blue color code #4169E1 RGB(65, 105, 225) cmyk(71%,53%,0%,12%)
Cream color code #FFFDD0 RGB(255, 253, 208) cmyk(0%,1%,18%,0%)
Dark Blue color code #00008B RGB(0, 0, 139) cmyk(100%,100%,0%,45%)
Magenta color code #8B008B RGB(139, 0, 139) cmyk(0%,100%,0%,45%)
Peach color code #FFDAB9 RGB(255, 218, 185) cmyk(0%,15%,27%,0%)
Dark Green color code #006400 RGB(0, 100, 0) cmyk(100%,0%,100%,61%)
Turquoise color code #40E0D0 RGB(64, 224, 208) cmyk(71%,0%7%,12%)
Coral color code #FF7F50 RGB(255, 127, 80) cmyk(0%,50%,69%,0%)
Black color code #000000 RGB(0, 0, 0) cmyk(0%,0%,0%,100%)
Lime Green color code #32CD32 RGB(50, 205, 50) cmyk(76%,0%,76%,20%)
Rose Gold color code #b76e79 RGB(183,110,121) cmyk(0%,40%,34%,28%)
Emerald color code #50C878 RGB(80, 200, 120) cmyk(60%,0%,40%,22%)
Bronze color code #CD7F32 RGB(205,127,50) cmyk(0%,38%,76%,20%)

FAQ on RGB To HEX Conversion

FAQ icon

  • RGB stands for Red(R), Green (G), Blue (B). RGB is a color model where these colors are combined to create other colors. RGB for White is 255, 255, 255. RGB for Black is 0, 0, 0.
    All other colors are in between these two.

  • Hex code is hexadecimal representation of RGB code. It expresses the same color in hex format.
    Hexadecimal system uses 0-9 , A-F to represent the binary digits. 255 is FF in hexadecimal and 0 is 0 in hexadecimal.
    So white is FFFFFF in hexadecimal.

  • It is a more compact and shorter represenation of the color and uses fixed 6 digits unlike RGB that varies between 1 to 3 digits for each of R, G and B.

  • HSL : H - Hue, S - Saturation, L - Lightness. Hue means color (combination of Red, Blue and Green). Saturation refers to the intensity and purity of the color.
    100% means the color or hue is pure not mixed with other shades, 0% means it's more of grey and not pure. Lightness is same as Brightness which is amount of white / black color added to it.
    100% white is one end of lightness and 100% black is the other end representing 0 brightness.
    Hue is value between 0 to 255 (0xFF), Saturation and Value are in %.

  • HSL : H - Hue, S - Saturation, V - Value. Hue means color (the combination of Red, Blue and Green).
    Saturation refers to the intensity and purity of it. As saturation increases it tends towards white shades and 100% means the color is white.
    Value is the brightness of a color. light color are also referred as tints and dark color are referred as shades. It does not go to white but from black to the chosen hue.
    Hue is value between 0 to 255 (0xFF), Saturation and Value are in %.

  • HSB is hue, saturation and brightness. It is same as HSV.

  • HSB and HSV are same. HSB is Hue Saturation Brightness. HSL and HSB/HSV are different.

  • Hue is same in HSL and HSV but saturation and light/bright behavior is different in both. Saturation indicates intensity in both.
    In HSL , they grey component increases and becomes max as 100% but it's not white. In HSV, 100% saturation becomes white.
    The Lightness / Brightness in HSV goes all the way from black (0%) to white (100%). In HSV, it goes from black to selected hue.
    So the range of % in saturation and lightness/brightness values vary.

  • These color models are mainly used in computer software like image processing/editing tools, image scraping , facial recognition, computer graphic applications.
    RGB is a simple visual color model as perceived by the human eye.
    HSV, HSL are used by computer systems to process color information with intensity, lightness and other parameters and create a visual model that matches that of human visual processing.

  • CMYK is another color model and industry standard for color printing. CMYK Stands for Cyan, Magenta, Yellow and Key(Black).

  • RGB - when all colors are combined, it is white in RGB and absence of color is black.
    CMYK - when all colors are combined it is black and absence of color is white.
    Screens, Televisions and monitors all use RGB color model. Wherever visual medium is based on transmitted 'light', RGB is preferred.
    CMYK is mainly used in color printing.

  • The different colors are combined in various ways to produce new colors going from darkness to lightness.
    It starts with Black which is rgb(0,0,0) and as the colors are added in different intensity, it produces new colors of increasing values
    It finally becomes White which is ryb (255,255,255). RGB is an additive color system and creates illumining colors on screen using transmitted light.

  • It starts with White (bg such as paper) and then when subtractive colors are mixed with it, it becomes darker and darker till it is black.
    CMYK is a subtractive color system where adding Cyan, Magenta and Yellow to white in equal measures makes it black.
    Black is the 'K' part of CMYK also known as the key color. This is based on reflective light from a white medium.

  • Brightness is absolute value like 0%, 25%, 60%, 100% and it's independent of the observer.
    Lightness is perceived view of the brightness. It depends on the observer.
    Luminosity is the light emitted by an object. It depends on the surface area, object type and a calculated value.

  • rgb is 255, 215, 0

  • Convert the red, green and blue color values from decimal to hex. Concatenate the 3 hex values of the red, green and blue together: RRGGBB.

  • Get the 2 left digits of the hex color code and convert to decimal value to get the red color level.
    Get the 2 middle digits of the hex color code and convert to decimal value to get the green color level.
    Get the 2 right digits of the hex color code and convert to decimal value to get the blue color level. And get 3 values that correspond to RGB values.