About This Tool
RGB to HEX converts red, green, and blue channels to a 6-digit HEX color. Choose uppercase or lowercase output and check both the RGB notation and actual color.
How to Use
- Enter R, G, and B separately. Each channel must be an integer from 0 to 255.
- Turn Uppercase HEX on or off as needed.
- View the live result or click Convert, then copy the HEX code.
- Click Reset to restore the defaults or load an example to compare colors.
Examples
- R 255, G 87, B 51 → #ff5733, or #FF5733 with uppercase enabled.
- R 0, G 0, B 0 → #000000.
- R 255, G 255, B 255 → #ffffff.
How the Calculation Works
Each channel is converted to two hexadecimal digits, padded with a leading 0 when needed, then joined in R, G, B order. Letter case changes only the text, not the color. Out-of-range values, empty inputs, and decimals produce errors; 300 is never silently changed to 255.
Common Uses
- Use RGB values from drawing or image software in CSS.
- Keep color-code capitalization consistent across a project.
- Confirm that all three manually entered channels are within range.
Privacy
All input processing, calculations, CSS generation, and previews run in your browser. Your content is never uploaded. No backend, database, online API, or third-party CDN is used, and your input is not saved automatically.
FAQ
Why does RGB range from 0 to 255?
This tool uses standard 8-bit sRGB channels. Each has 256 integer levels, from 0 to 255.
Can I enter 12.5 or 256?
No. Every channel must be an integer from 0 to 255. Invalid values trigger a clear error message.
Does uppercase HEX differ from lowercase HEX?
#FF5733 and #ff5733 represent the same color. Choose the case that matches your project's coding style.
Why do some HEX channels start with 0?
Each channel must contain two digits. For example, 9 is written as 09 so the following channels stay in the correct positions.