RGB to HEX
Convert RGB to six-digit HEX, or convert 3- or 6-digit HEX to RGB, without clamping invalid channels or putting the color in the URL.
Paste rgb(255, 87, 51), 255,87,51, or 255 87 51. Every channel must be a whole number from 0 through 255.
Use 3 or 6 hexadecimal digits, with or without #. Alpha forms with 4 or 8 digits are not accepted.
Private by design: the color stays in this browser and is never added to the URL or saved by this tool.
Check the color input
Error:
- HEX
- RGB
- Red channel
- Green channel
- Blue channel
How RGB becomes a HEX color
RGB stores red, green, and blue as three decimal channels from 0 through 255. Convert each channel to a two-digit hexadecimal pair, then join the pairs in #RRGGBB order. For rgb(255, 87, 51), 255 becomes FF, 87 becomes 57, and 51 becomes 33, producing #FF5733.
The reverse calculation splits six HEX digits into red, green, and blue pairs and converts each pair back to decimal. Three-digit shorthand expands each digit first: #F53 becomes #FF5533, then rgb(255, 85, 51).
Accepted RGB and HEX input
RGB mode accepts a CSS-style rgb() function, a comma-separated triplet, or a whitespace-separated triplet. Every channel must be present as a whole base-10 integer. Raw input is limited to 80 characters before surrounding whitespace is removed. Blank channels, decimals, scientific notation, percentages, negative values, and values above 255 fail closed and remove any earlier result.
HEX mode accepts exactly three or six hexadecimal digits, with an optional leading #. Letters are case-insensitive and output is normalized to uppercase. Four- and eight-digit alpha colors are outside this page, as are named colors, HSL, HSV, CMYK, gradients, images, palettes, and color picking from the screen.
Common decimal and hexadecimal channel values
| Decimal channel | HEX pair | Example use |
|---|---|---|
| 0 | 00 | No intensity |
| 15 | 0F | Leading zero is retained |
| 51 | 33 | Blue in #FF5733 |
| 87 | 57 | Green in #FF5733 |
| 128 | 80 | Midpoint channel |
| 255 | FF | Full intensity |
Local conversion and predictable errors
The converter keeps the current input and result only in this page memory. It does not use a native color picker, read the clipboard automatically, write a query string or fragment, save history, or make an application network request. Copy runs only after you choose the button; a changed or cleared result cannot report a delayed copy as successful.
With JavaScript disabled, the conversion method, accepted formats, limits, examples, and source remain readable. Interactive conversion requires JavaScript, and pressing Enter cannot submit or navigate the static page.
Frequently asked questions
What is RGB(255, 87, 51) in HEX?
RGB(255, 87, 51) is #FF5733. The red, green, and blue channels become FF, 57, and 33 in hexadecimal.
Can I paste an RGB color?
Yes. Paste rgb(255, 87, 51), 255,87,51, or 255 87 51. Each channel must be a complete whole number from 0 through 255.
Can I convert HEX back to RGB?
Yes. Switch to HEX to RGB on this page and enter a 3- or 6-digit color such as #F53 or #FF5733.
Does this converter support alpha transparency?
No. Four- and eight-digit HEX, rgba(), percentages, and slash alpha syntax are rejected instead of being silently changed.
Is my color saved or uploaded?
No. Conversion runs in your browser. The tool does not place the color in the URL, save it to browser storage, or send it as analytics data.