🇺🇸English
🇨🇳简体中文
🇺🇸English

RGB to HEX Color Converter Online · HEX Color Code Interconversion

Online RGB and hexadecimal color code interconversion tool, quickly convert RGB to HEX and HEX to RGB, support real-time color preview, with a reference table of 140 common colors.

RGB Input
HEX Input

Conversion Result · Color Preview

#FFB406
Red (R)255
Green (G)180
Blue (B)6
HEX Code#FFB406
RGB Valuergb(255, 180, 6)

Common Color Reference Table

ColorNameDescriptionHexadecimalRGB
LightPinkLight Pink#FFB6C1255,182,193
PinkPink#FFC0CB255,192,203
CrimsonCrimson#DC143C220,20,60
LavenderBlushLavender Blush#FFF0F5255,240,245
PaleVioletRedPale Violet Red#DB7093219,112,147
HotPinkHot Pink#FF69B4255,105,180
DeepPinkDeep Pink#FF1493255,20,147
MediumVioletRedMedium Violet Red#C71585199,21,133
OrchidOrchid#DA70D6218,112,214
ThistleThistle#D8BFD8216,191,216
PlumPlum#DDA0DD221,160,221
VioletViolet#EE82EE238,130,238
MagentaMagenta#FF00FF255,0,255
FuchsiaFuchsia#FF00FF255,0,255
DarkMagentaDark Magenta#8B008B139,0,139
PurplePurple#800080128,0,128
MediumOrchidMedium Orchid#BA55D3186,85,211
DarkVioletDark Violet#9400D3148,0,211
DarkOrchidDark Orchid#9932CC153,50,204
IndigoIndigo#4B008275,0,130
BlueVioletBlue Violet#8A2BE2138,43,226
MediumPurpleMedium Purple#9370DB147,112,219
MediumSlateBlueMedium Slate Blue#7B68EE123,104,238
SlateBlueSlate Blue#6A5ACD106,90,205
DarkSlateBlueDark Slate Blue#483D8B72,61,139
LavenderLavender#E6E6FA230,230,250
GhostWhiteGhost White#F8F8FF248,248,255
BlueBlue#0000FF0,0,255
MediumBlueMedium Blue#0000CD0,0,205
MidnightBlueMidnight Blue#19197025,25,112
DarkBlueDark Blue#00008B0,0,139
NavyNavy#0000800,0,128
RoyalBlueRoyal Blue#4169E165,105,225
CornflowerBlueCornflower Blue#6495ED100,149,237
LightSteelBlueLight Steel Blue#B0C4DE176,196,222
LightSlateGrayLight Slate Gray#778899119,136,153
SlateGraySlate Gray#708090112,128,144
DodgerBlueDodger Blue#1E90FF30,144,255
AliceBlueAlice Blue#F0F8FF240,248,255
SteelBlueSteel Blue#4682B470,130,180
LightSkyBlueLight Sky Blue#87CEFA135,206,250
SkyBlueSky Blue#87CEEB135,206,235
DeepSkyBlueDeep Sky Blue#00BFFF0,191,255
LightBlueLight Blue#ADD8E6173,216,230
PowderBluePowder Blue#B0E0E6176,224,230
CadetBlueCadet Blue#5F9EA095,158,160
AzureAzure#F0FFFF240,255,255
LightCyanLight Cyan#E1FFFF225,255,255
PaleTurquoisePale Turquoise#AFEEEE175,238,238
CyanCyan#00FFFF0,255,255
AquaAqua#D4F2E7212,242,231
DarkTurquoiseDark Turquoise#00CED10,206,209
DarkSlateGrayDark Slate Gray#2F4F4F47,79,79
DarkCyanDark Cyan#008B8B0,139,139
TealTeal#0080800,128,128
MediumTurquoiseMedium Turquoise#48D1CC72,209,204
LightSeaGreenLight Sea Green#20B2AA32,178,170
TurquoiseTurquoise#40E0D064,224,208
AquamarineAquamarine#7FFFAA127,255,170
MediumAquamarineMedium Aquamarine#00FA9A0,250,154
MediumSpringGreenMedium Spring Green#00FF7F0,255,127
MintCreamMint Cream#F5FFFA245,255,250
SpringGreenSpring Green#3CB37160,179,113
SeaGreenSea Green#2E8B5746,139,87
HoneydewHoneydew#F0FFF0240,255,240
LightGreenLight Green#90EE90144,238,144
PaleGreenPale Green#98FB98152,251,152
DarkSeaGreenDark Sea Green#8FBC8F143,188,143
LimeGreenLime Green#32CD3250,205,50
LimeLime#00FF000,255,0
ForestGreenForest Green#228B2234,139,34
GreenGreen#0080000,128,0
DarkGreenDark Green#0064000,100,0
ChartreuseChartreuse#7FFF00127,255,0
LawnGreenLawn Green#7CFC00124,252,0
GreenYellowGreen Yellow#ADFF2F173,255,47
OliveDrabOlive Drab#556B2F85,107,47
BeigeBeige#F5F5DC245,245,220
LightGoldenrodYellowLight Goldenrod Yellow#FAFAD2250,250,210
IvoryIvory#FFFFF0255,255,240
LightYellowLight Yellow#FFFFE0255,255,224
YellowYellow#FFFF00255,255,0
OliveOlive#808000128,128,0
DarkKhakiDark Khaki#BDB76B189,183,107
LemonChiffonLemon Chiffon#FFFACD255,250,205
PaleGoldenrodPale Goldenrod#EEE8AA238,232,170
KhakiKhaki#F0E68C240,230,140
GoldGold#FFD700255,215,0
CornsilkCornsilk#FFF8DC255,248,220
GoldenrodGoldenrod#DAA520218,165,32
FloralWhiteFloral White#FFFAF0255,250,240
OldLaceOld Lace#FDF5E6253,245,230
WheatWheat#F5DEB3245,222,179
MoccasinMoccasin#FFE4B5255,228,181
OrangeOrange#FFA500255,165,0
PapayaWhipPapaya Whip#FFEFD5255,239,213
BlanchedAlmondBlanched Almond#FFEBCD255,235,205
NavajoWhiteNavajo White#FFDEAD255,222,173
AntiqueWhiteAntique White#FAEBD7250,235,215
TanTan#D2B48C210,180,140
BurlyWoodBurly Wood#DEB887222,184,135
BisqueBisque#FFE4C4255,228,196
DarkOrangeDark Orange#FF8C00255,140,0
LinenLinen#FAF0E6250,240,230
PeruPeru#CD853F205,133,63
PeachPuffPeach Puff#FFDAB9255,218,185
SandyBrownSandy Brown#F4A460244,164,96
ChocolateChocolate#D2691E210,105,30
SaddleBrownSaddle Brown#8B4513139,69,19
SeaShellSea Shell#FFF5EE255,245,238
SiennaSienna#A0522D160,82,45
LightSalmonLight Salmon#FFA07A255,160,122
CoralCoral#FF7F50255,127,80
OrangeRedOrange Red#FF4500255,69,0
DarkSalmonDark Salmon#E9967A233,150,122
TomatoTomato#FF6347255,99,71
MistyRoseMisty Rose#FFE4E1255,228,225
SalmonSalmon#FA8072250,128,114
SnowSnow#FFFAFA255,250,250
LightCoralLight Coral#F08080240,128,128
RosyBrownRosy Brown#BC8F8F188,143,143
IndianRedIndian Red#CD5C5C205,92,92
RedRed#FF0000255,0,0
BrownBrown#A52A2A165,42,42
FireBrickFire Brick#B22222178,34,34
DarkRedDark Red#8B0000139,0,0
MaroonMaroon#800000128,0,0
WhiteWhite#FFFFFF255,255,255
WhiteSmokeWhite Smoke#F5F5F5245,245,245
GainsboroGainsboro#DCDCDC220,220,220
LightGreyLight Grey#D3D3D3211,211,211
SilverSilver#C0C0C0192,192,192
DarkGrayDark Gray#A9A9A9169,169,169
GrayGray#808080128,128,128
DimGrayDim Gray#696969105,105,105
BlackBlack#0000000,0,0

What is an RGB to HEX Color Converter?

I. The RGB Color Model

RGB is an additive color model that creates a broad spectrum of colors by superimposing red, green, and blue light at varying intensities. Each color channel accepts a value from 0 to 255, providing 256 distinct levels. The combination of these three channels can represent over 16.7 million unique colors. This model is fundamental to digital displays, including computer monitors, televisions, and smartphone screens, making it a cornerstone of digital color theory. For web developers and digital designers, understanding how to manipulate these three channels is essential for creating visually appealing and color-accurate content across different devices.

RGB color value format: rgb(R, G, B) — for example, rgb(255, 180, 6)

II. Hexadecimal Color Codes (HEX)

A hexadecimal color code is a compact, human-readable representation of an RGB value. It begins with a hash symbol (#) followed by six hexadecimal digits. These six digits are grouped into three pairs, where each pair corresponds to the red, green, and blue color channels, respectively. Hexadecimal, or base-16, uses the characters 0-9 and A-F to represent values. A two-digit hexadecimal number can perfectly represent the decimal range of 0 to 255, where 00 equals 0 and FF equals 255. This format is the standard for defining colors in HTML, CSS, and SVG, and is widely used by software engineers and UI designers for its precision and brevity.

HEX color code format: #RRGGBB — for example, #FFB406

III. The Mathematical Principle of RGB to HEX Conversion

The conversion from RGB to HEX is a straightforward numerical conversion from decimal (base-10) to hexadecimal (base-16). For each RGB channel value (0-255), you divide the decimal number by 16. The quotient becomes the first hexadecimal digit, and the remainder becomes the second. For instance, if the red value is 255, dividing by 16 gives a quotient of 15 and a remainder of 15. In hexadecimal, 15 is represented by the letter 'F'. Therefore, the red channel converts to 'FF'. This process is repeated for the green and blue channels, and the three resulting pairs are concatenated to form the final 6-digit HEX color code.

Example: RGB(255, 180, 6) → R=255=FF, G=180=B4, B=6=06 → #FFB406

IV. The Mathematical Principle of HEX to RGB Conversion

The reverse conversion, from HEX to RGB, involves parsing each pair of hexadecimal digits back into a decimal value. The first digit of a pair is multiplied by 16 and then added to the second digit to get the final decimal value. For example, with the hex code #FFB406, the red component 'FF' is calculated as (15 × 16) + 15 = 255. The green component 'B4' is (11 × 16) + 4 = 180, and the blue component '06' is (0 × 16) + 6 = 6. This method also applies to shorthand 3-digit HEX codes, where each digit is duplicated; for example, #F00 is equivalent to #FF0000, providing a convenient shorthand for colors like pure red.

Example: #CC00FF → R=CC=12×16+12=204, G=00=0, B=FF=15×16+15=255 → rgb(204, 0, 255)

How to Use This RGB to HEX Converter Tool

This online color converter is designed for efficiency and ease of use. To convert an RGB color to its hexadecimal equivalent, simply enter the decimal values (0-255) for the Red, Green, and Blue channels in the "RGB Input" section. The conversion happens in real time as you type, or you can click the "RGB to HEX" button. The resulting HEX color code and a live preview of the color will be displayed instantly in the result panel. Conversely, to perform a HEX to RGB conversion, type or paste a 6-digit hexadecimal color code (with or without the '#') into the "HEX Input" field. The tool will parse the code and display the corresponding R, G, and B channel values. The visual color preview makes it simple to verify your color selections at a glance, and the comprehensive color reference table below can serve as a quick lookup for standard web colors.

Frequently Asked Questions

What is a hex color code and how is it used in web design?
A hex color code is a 6-digit representation of a color used extensively in HTML, CSS, and graphic design. It's a fundamental tool for defining colors on the web, allowing developers to precisely control the visual appearance of text, backgrounds, borders, and other UI elements. For instance, a CSS rule like `color: #3498db;` sets text to a specific shade of blue.

How do I manually convert an RGB value like 120, 80, 200 to hex?
You convert each number to its two-digit base-16 equivalent. 120 divided by 16 is 7 with a remainder of 8, so the hex pair is 78. 80 divided by 16 is 5 with a remainder of 0, giving 50. 200 divided by 16 is 12 (which is C in hex) with a remainder of 8, giving C8. The full hex code is #7850C8.

Can I use this tool for CSS color conversion?
Absolutely. This tool is perfect for CSS color conversion. Whether you're given a color as RGB values from a design specification or need to convert a hex color to an RGBA format to add opacity, this tool provides a quick and accurate way to bridge the gap between different color representation formats.

What is the valid range for RGB values?
The valid range for each RGB channel (Red, Green, Blue) is from 0 to 255, inclusive. A value of 0 means the channel has no light, while 255 is the maximum intensity. Values outside this range are invalid and will cause a conversion error in any standard color system.

Does the tool support shorthand 3-digit hex codes like #FFF?
Yes, it does. The converter recognizes 3-digit shorthand hex codes. If you input #ABC, the system automatically expands it to the full 6-digit code #AABBCC before performing the RGB conversion. This is a standard practice for handling web-safe colors defined in a compact format.

Why does my hex color sometimes look different on another screen?
A hex code represents a precise color formula, but its appearance can vary across monitors due to differences in screen calibration, color profiles, and panel technology. A professional designer would use a color management system and calibrate their monitor to ensure color accuracy between the digital code and the physical display.

Is there a difference between #000 and #000000?
In web standards, there is no difference in the color they represent. Both are pure black. The #000 format is a convenient shorthand where each character is implicitly duplicated to form a 6-digit code. The full #000000 is the explicit, canonical form. Both are understood by all modern browsers.

Can I use this converter for mobile app development?
Yes, the conversion principles are universal. Mobile platforms like iOS (Swift UI/UIKit) and Android (Jetpack Compose/XML layouts) use color definitions that are often based on RGB or hex models. This tool can help you port a color palette from a web project to a mobile platform by converting between these standard formats.

What is the purpose of the color reference table?
The table provides a quick reference for 140 common named web colors with their corresponding HEX codes, RGB values, and descriptive names. This is a valuable resource for quickly looking up standard colors like "Tomato", "DodgerBlue", or "MediumSpringGreen" without needing to memorize or search for their precise color codes.