RGB and HEX converter
Convert RGB to HEX or HEX to RGB and preview an opaque sRGB colour.
Enter data
Choose a direction. Enter three RGB channels from 0–255 or a 3- or 6-digit HEX code. Fields marked with an asterisk are required.
About this tool
RGB and HEX can describe the same colour in two notations. One form supports both directions, checks channel ranges and expands shorthand HEX. Use it when setting website colours or reviewing design codes. The preview is neither monitor calibration nor a contrast test.
How to use the calculator
- Choose RGB → HEX or HEX → RGB.
- Complete the active fields and select “Convert”. Copy the output code only.
Calculation details
Formula and calculation method
RGB → HEX: write each integer channel as two hexadecimal digits. HEX → RGB: decode pairs RR, GG, BB. Expand shorthand #RGB into #RRGGBB.
Worked example
RGB (0, 255, 136) gives #00FF88. Shorthand #0F8 means the same colour and produces rgb(0, 255, 136). Channel 256 and HEX with alpha are rejected.
Limitations
- Opaque 8-bit sRGB only: integer channels 0–255 and 3- or 6-digit HEX. No CSS names, RGB percentages, RGBA, HSL, HDR or ICC profiles.
- Swatch appearance depends on the display and browser. A colour code does not establish accessibility or printed appearance.
Sources
Engine version: 1.0.0 · Last reviewed: 2 October 2026
Frequently asked questions
Is #FFF the same as #FFFFFF?
Yes. Each shorthand digit is repeated, so #FFF is white rgb(255, 255, 255).
Can RGB channels be fractional?
Not here. We accept integers from 0–255, without rounding invalid input.
Can I add transparency?
No. Four- and eight-digit HEX and RGBA are unsupported.
Is the file or colour uploaded?
No. Processing happens in the browser without adding input or output to analytics, the URL or form history. Loading the page connects to hosting. Clipboard copies, downloads and browser extensions remain outside reset control.