RGB to Hex color conversion
RGB to Hex color conversion. Exact conversion factors, worked examples, and privacy-first browser calculation on CalculatorX. Runs locally in your browser.
Enter values to convert.
Formulas
Core equations used by this converter.
How to use
Choose RGB → HEX or HEX → RGB
Use the tabs in the converter to switch direction.
Enter RGB or hex values
Fill in the active fields for the selected direction.
Convert and read the result
Use Convert or let the result update automatically.
Example conversions
Common values with formula and result.
rgb(255, 0, 0) → HEX
rgb(255, 0, 0) → HEX
rgb(255, 215, 0) → HEX (gold)
rgb(255, 215, 0) → HEX (gold)
rgb(0, 128, 128) → HEX (teal)
rgb(0, 128, 128) → HEX (teal)
RGB to Hex color conversion specification
Version 1.1.0 · Engine tested
- Engine tested 3 published cases
- Named expert review Not performed
- Calculation version 1.1.0
- Definition
- **RGB** — red, green, blue channels as integers **0–255** (8 bits each → 16,777,216 colors). **HEX** — the same three channels written as six hexadecimal digits `#RRGGBB`.
- What it calculates
- Convert RGB (0–255) to HEX #RRGGBB. Decimal-to-hex per channel, worked examples, color chart, and FAQ.
- Inputs
- Values required by the selected conversion mode
- Outputs
- Converted result in the target unit or format
- Formula
RR = R.toString(16).padStart(2,'0') (same for G, B) · #RRGGBB- RGB to Hex color table
Color name RGB (R, G, B) Hex Black (0, 0, 0) #000000 White (255, 255, 255) #FFFFFF Red (255, 0, 0) #FF0000 Lime (0, 255, 0) #00FF00 Blue (0, 0, 255) #0000FF Yellow (255, 255, 0) #FFFF00 Cyan (0, 255, 255) #00FFFF Magenta (255, 0, 255) #FF00FF Silver (192, 192, 192) #C0C0C0 Gray (128, 128, 128) #808080 Maroon (128, 0, 0) #800000 Olive (128, 128, 0) #808000 - Assumptions
- Conversion runs locally in the browser; values are not uploaded.
- Uses the formulas documented on this page.
- Units
- Hex channels
- Combined
- Boundary conditions
- Empty or invalid input yields no valid result.
- Out-of-range values may be rejected by the tool runtime.
- Example
- rgb(255, 0, 0) → HEX → #FF0000
- Validation cases
- rgb(255, 0, 0) → HEX → #FF0000
- rgb(255, 215, 0) → HEX (gold) → #FFD700
- rgb(0, 128, 128) → HEX (teal) → #008080
- Sources
- CalculatorX converter runtime
- Standard unit / encoding definitions where applicable
- Calculation version
- 1.1.0
Background
Interpretation and common distinctions.
Use the converter tabs to switch direction when available. Results for RGB to Hex color conversion update locally in your browser.
Related tools
Frequently asked questions
Key distinctions behind the conversion.
How do you convert using RGB to Hex color conversion?
Use RR = R.toString(16).padStart(2,'0') (same for G, B). Example: rgb(255, 0, 0) → HEX → #FF0000.
Can I switch direction?
Open the related reverse converter listed under Related tools.
Does this run online or locally?
Calculation runs locally in your browser. Values are not uploaded.
How precise are the results?
Results follow the formulas on this page. Round to the precision your use case needs.