MockFoxAdvertise

RGB to HEX Converter

Updated Free mock REST & WebSocket APIs

Enter red, green and blue values from 0 to 255 — or paste an rgb() string — and get the hex code instantly.

HEX#4f46e5≈ slateblue
RGB
⇄
HEX

Accepts #RGB, #RRGGBB, 8-digit #RRGGBBAA, with or without the # — or paste any CSS color.

Every format
HEX#4f46e5
HEX (uppercase)#4F46E5
RGBrgb(79, 70, 229)
CSS rgb() modernrgb(79 70 229)
HSLhsl(243, 75%, 59%)
HSV / HSBhsv(243, 69%, 90%)
CMYKcmyk(66%, 69%, 0%, 10%)
OKLCHoklch(51.06% 0.2301 276.97)
Decimal 0–10.310, 0.275, 0.898

🔒 Converted instantly in your browser. Need more control? Open the full color picker.

How to convert RGB to HEX

  1. Type the three numbers into R, G and B, use the sliders, or paste rgb(79, 70, 229) (even just 79, 70, 229) into the text box.
  2. Copy the hex result — #4f46e5. Add an alpha value (rgba(…, 0.5)) to get 8-digit hex.

The formula

Convert each channel (0–255) to base 16 and pad it to two digits: divide by 16 — the whole part is the first digit, the remainder the second (10–15 become a–f).

Example: rgb(255, 99, 71) → 255 = 15×16 + 15 → ff; 99 = 6×16 + 3 → 63; 71 = 4×16 + 7 → 47, so the hex code is #ff6347 (tomato).

In JavaScript: "#" + [r, g, b].map(n => n.toString(16).padStart(2, "0")).join(""). Don't forget the padding — 9 must become 09, not 9.

Common RGB values

ColorRGBHEX
Black0, 0, 0#000000
White255, 255, 255#ffffff
Red255, 0, 0#ff0000
Green (lime)0, 255, 0#00ff00
Blue0, 0, 255#0000ff
Mid gray128, 128, 128#808080

CSS named colors

ColorHEXRGB
#f0f8ffrgb(240, 248, 255)
#faebd7rgb(250, 235, 215)
#00ffffrgb(0, 255, 255)
#7fffd4rgb(127, 255, 212)
#f0ffffrgb(240, 255, 255)
#f5f5dcrgb(245, 245, 220)
#ffe4c4rgb(255, 228, 196)
#000000rgb(0, 0, 0)
#ffebcdrgb(255, 235, 205)
#0000ffrgb(0, 0, 255)
#8a2be2rgb(138, 43, 226)
#a52a2argb(165, 42, 42)
#deb887rgb(222, 184, 135)
#5f9ea0rgb(95, 158, 160)
#7fff00rgb(127, 255, 0)
#d2691ergb(210, 105, 30)
#ff7f50rgb(255, 127, 80)
#6495edrgb(100, 149, 237)
#fff8dcrgb(255, 248, 220)
#dc143crgb(220, 20, 60)
#00ffffrgb(0, 255, 255)
#00008brgb(0, 0, 139)
#008b8brgb(0, 139, 139)
#b8860brgb(184, 134, 11)
#a9a9a9rgb(169, 169, 169)
#006400rgb(0, 100, 0)
#a9a9a9rgb(169, 169, 169)
#bdb76brgb(189, 183, 107)
#8b008brgb(139, 0, 139)
#556b2frgb(85, 107, 47)
#ff8c00rgb(255, 140, 0)
#9932ccrgb(153, 50, 204)
#8b0000rgb(139, 0, 0)
#e9967argb(233, 150, 122)
#8fbc8frgb(143, 188, 143)
#483d8brgb(72, 61, 139)
#2f4f4frgb(47, 79, 79)
#2f4f4frgb(47, 79, 79)
#00ced1rgb(0, 206, 209)
#9400d3rgb(148, 0, 211)
#ff1493rgb(255, 20, 147)
#00bfffrgb(0, 191, 255)
#696969rgb(105, 105, 105)
#696969rgb(105, 105, 105)
#1e90ffrgb(30, 144, 255)
#b22222rgb(178, 34, 34)
#fffaf0rgb(255, 250, 240)
#228b22rgb(34, 139, 34)
#ff00ffrgb(255, 0, 255)
#dcdcdcrgb(220, 220, 220)
#f8f8ffrgb(248, 248, 255)
#ffd700rgb(255, 215, 0)
#daa520rgb(218, 165, 32)
#808080rgb(128, 128, 128)
#008000rgb(0, 128, 0)
#adff2frgb(173, 255, 47)
#808080rgb(128, 128, 128)
#f0fff0rgb(240, 255, 240)
#ff69b4rgb(255, 105, 180)
#cd5c5crgb(205, 92, 92)
#4b0082rgb(75, 0, 130)
#fffff0rgb(255, 255, 240)
#f0e68crgb(240, 230, 140)
#e6e6fargb(230, 230, 250)
#fff0f5rgb(255, 240, 245)
#7cfc00rgb(124, 252, 0)
#fffacdrgb(255, 250, 205)
#add8e6rgb(173, 216, 230)
#f08080rgb(240, 128, 128)
#e0ffffrgb(224, 255, 255)
#fafad2rgb(250, 250, 210)
#d3d3d3rgb(211, 211, 211)
#90ee90rgb(144, 238, 144)
#d3d3d3rgb(211, 211, 211)
#ffb6c1rgb(255, 182, 193)
#ffa07argb(255, 160, 122)
#20b2aargb(32, 178, 170)
#87cefargb(135, 206, 250)
#778899rgb(119, 136, 153)
#778899rgb(119, 136, 153)
#b0c4dergb(176, 196, 222)
#ffffe0rgb(255, 255, 224)
#00ff00rgb(0, 255, 0)
#32cd32rgb(50, 205, 50)
#faf0e6rgb(250, 240, 230)
#ff00ffrgb(255, 0, 255)
#800000rgb(128, 0, 0)
#66cdaargb(102, 205, 170)
#0000cdrgb(0, 0, 205)
#ba55d3rgb(186, 85, 211)
#9370dbrgb(147, 112, 219)
#3cb371rgb(60, 179, 113)
#7b68eergb(123, 104, 238)
#00fa9argb(0, 250, 154)
#48d1ccrgb(72, 209, 204)
#c71585rgb(199, 21, 133)
#191970rgb(25, 25, 112)
#f5fffargb(245, 255, 250)
#ffe4e1rgb(255, 228, 225)
#ffe4b5rgb(255, 228, 181)
#ffdeadrgb(255, 222, 173)
#000080rgb(0, 0, 128)
#fdf5e6rgb(253, 245, 230)
#808000rgb(128, 128, 0)
#6b8e23rgb(107, 142, 35)
#ffa500rgb(255, 165, 0)
#ff4500rgb(255, 69, 0)
#da70d6rgb(218, 112, 214)
#eee8aargb(238, 232, 170)
#98fb98rgb(152, 251, 152)
#afeeeergb(175, 238, 238)
#db7093rgb(219, 112, 147)
#ffefd5rgb(255, 239, 213)
#ffdab9rgb(255, 218, 185)
#cd853frgb(205, 133, 63)
#ffc0cbrgb(255, 192, 203)
#dda0ddrgb(221, 160, 221)
#b0e0e6rgb(176, 224, 230)
#800080rgb(128, 0, 128)
#663399rgb(102, 51, 153)
#ff0000rgb(255, 0, 0)
#bc8f8frgb(188, 143, 143)
#4169e1rgb(65, 105, 225)
#8b4513rgb(139, 69, 19)
#fa8072rgb(250, 128, 114)
#f4a460rgb(244, 164, 96)
#2e8b57rgb(46, 139, 87)
#fff5eergb(255, 245, 238)
#a0522drgb(160, 82, 45)
#c0c0c0rgb(192, 192, 192)
#87ceebrgb(135, 206, 235)
#6a5acdrgb(106, 90, 205)
#708090rgb(112, 128, 144)
#708090rgb(112, 128, 144)
#fffafargb(255, 250, 250)
#00ff7frgb(0, 255, 127)
#4682b4rgb(70, 130, 180)
#d2b48crgb(210, 180, 140)
#008080rgb(0, 128, 128)
#d8bfd8rgb(216, 191, 216)
#ff6347rgb(255, 99, 71)
#40e0d0rgb(64, 224, 208)
#ee82eergb(238, 130, 238)
#f5deb3rgb(245, 222, 179)
#ffffffrgb(255, 255, 255)
#f5f5f5rgb(245, 245, 245)
#ffff00rgb(255, 255, 0)
#9acd32rgb(154, 205, 50)

Related tools

Embed this tool on your site

Browse all embeddable tools →

Free for blogs, HR, payroll and contractor sites: copy one snippet — the widget sizes itself and matches your colors.

Get the embed code

Frequently asked questions

Is it free and private?

Yes. It's free with no sign-up, and it runs entirely in your browser — the colors you enter are never uploaded or logged.

What if my RGB values are percentages or 0–1 decimals?

Paste them as rgb(100%, 50%, 0%) and they're converted. For 0–1 decimals, multiply by 255 first (0.5 → 128).

How does alpha convert to hex?

Alpha 0–1 is multiplied by 255 and written as a fourth hex pair: 0.5 → 128 → 80, so rgba(0, 0, 0, 0.5) is #00000080.

Why does my converted color look different in print?

RGB and hex describe screen (sRGB) colors. Printers use CMYK inks with a smaller gamut, so vivid screen colors can look duller on paper.

Your business here? Sponsor this tool from $16/week. See placements