HomeAll ToolsCategoriesDeveloper ToolsAboutContact
Code / Developer tools

RGB to HEX

Convert Red, Green, and Blue channel values to standard CSS Hexadecimal color notation with real-time spectrum breakdowns.

terminal DEV UTILITY CSS COLOR 4 SPEC
Active Color #1D4ED8
tune

RGB Channels Input

0 - 255
0 (00) HEX: 1D 255 (FF)
0 - 255
0 (00) HEX: 4E 255 (FF)
0 - 255
0 (00) HEX: D8 255 (FF)
100% (1.00)
0% (Transparent / 00) 100% (Opaque / FF)
Example Presets Click to load
Hex Output Target sRGB
rgb(29, 78, 216) Luminance: 30.4%
Standard 6-digit Hex
#1D4ED8 palette
8-digit Hex (with Alpha) #RRGGBBAA
#1D4ED8FF
Channel Hex Breakdown
RR 1D (29)
GG 4E (78)
BB D8 (216)
CSS Syntax Snippets
background-color: #1d4ed8;
color: #1d4ed8;
bolt Calculation Engine: Local JavaScript (0ms latency)
24-bit TrueColor
menu_book

How to Convert RGB to HEX

01 Divide by 16

Compute First Hex Digit

Take the decimal channel integer (0–255) and divide it by 16. The integer quotient (0–15) maps directly to the first hexadecimal character (0–9 or A–F).

Example: 29 ÷ 16 = 1 (quotient = 1)
02 Find Remainder

Compute Second Hex Digit

Take the remainder of that division (value modulo 16). Map the remainder (0–15) to its corresponding hex character to complete the pair.

Example: 29 % 16 = 13 (13 maps to D)
03 Concatenate

Assemble Final String

Prefix with a hash (#) and join the pairs RR + GG + BB in strict order. If using transparency, append the 2-digit alpha channel AA at the tail.

Result: 1D + 4E + D8 = #1D4ED8
HOW TO USE

Convert RGB channels

Set red, green and blue from 0 to 255. Optional alpha adds opacity information to the result.

Example

Red 255, green 0 and blue 0 produce #ff 0000.

Before you use the result

Hex alpha support depends on the software where you paste the color.