RGB to Hex Converter
Convert any RGB value to its hex color code, along with corresponding HSL, HSV, and CMYK values (including HTML/CSS values).
Convert RGB to HEX
#EFBF04
Also available in
| Code | Value | HTML/CSS | |
|---|---|---|---|
| HSL | 48, 97, 48 | hsl(48 97% 48%) | |
| HSV | 48, 98, 94 | — | |
| CMYK | 0, 20, 98, 6 | — | |
| OKLCH | 0.82, 0.17, 90 | oklch(0.82 0.17 90) |
CMYK values are approximate. For production printing, use ICC profile-based conversion in your design software.
Use this color in Moda
Apply exact brand colors to slides, social posts, and other designs — all on a real canvas you control.
Try Moda free →How to convert RGB to hex
Each RGB channel is an integer from 0 to 255. To get hex, convert each number to base-16 and pad to two digits. 0 becomes "00", 15 becomes "0F", 255 becomes "FF". Concatenate all three to form the six-digit code. For example, RGB(123, 234, 111): 123 = 7×16+11 = "7B", 234 = 14×16+10 = "EA", 111 = 6×16+15 = "6F". Result: #7BEA6F.
When to use RGB vs hex
RGB is the native format for most programming languages and graphics APIs (Canvas, WebGL, OpenGL). Hex is the most common format in CSS and design tools. The two are interchangeable — hex is simply a more compact way to write the same three numbers. Use hex when writing CSS or sharing colors with designers; use RGB when working in code that manipulates channels numerically.
Worked example
Convert RGB(123, 234, 111) to hex: Red 123 → 7B. Green 234 → EA. Blue 111 → 6F. Result: #7BEA6F — a bright, minty green. You can verify by entering this hex value in any color picker to confirm it matches the original RGB input.
Shorthand hex codes
When both digits in each pair are identical (e.g., #AABBCC), CSS allows a shorthand notation (#ABC). This tool always outputs the full six-digit code for maximum compatibility, but you can manually shorten it when applicable. RGB(170, 187, 204) → #AABBCC → shorthand #ABC.
Frequently asked questions
How do I convert RGB to hex?
Each RGB channel (0–255) is converted to a two-digit hexadecimal number. For example, RGB(239, 191, 4) becomes EF (239), BF (191), 04 (4), giving the hex code #EFBF04.
What is the hex color format?
Hex colors are six-digit hexadecimal codes preceded by #. Each pair of digits represents one RGB channel: the first pair is red, the second is green, and the third is blue. Values range from 00 (0) to FF (255).
Is RGB(0, 0, 0) the same as #000000?
Yes. Both represent pure black — zero intensity in all three color channels.