Language
English English Vietnamese (Tiếng Việt) Vietnamese (Tiếng Việt) Chinese (简体中文) Chinese (简体中文) Portuguese (Brazil) (Português do Brasil) Portuguese (Brazil) (Português do Brasil) Spanish (Español) Spanish (Español) Indonesian (Bahasa Indonesia) Indonesian (Bahasa Indonesia)
Decimal to Hexadecimal

Decimal to Hexadecimal

Build a #RRGGBB string channel by channel from RGB numbers, with padding rules, the alpha pair and named CSS colours to check your method against.

Colour Channels, from 0-255 to Hex Pairs

Design tools hand you colours as three numbers between 0 and 255; stylesheets, brand guidelines and most component libraries want the same colour as a six-character hex string. Converting one channel at a time is the whole job — this page does the arithmetic so you can build #RRGGBB without opening a picker.

Two digits per channel: divide by 16, the quotient is the first digit and the remainder the second. Channel 205 gives 12 remainder 13, which is CD. So rgb(30, 144, 255) becomes #1E90FF.

When the Picker Is Not There

Specs Written in RGB

Brand documents and print handovers often list channel numbers only, leaving you to produce the web form for the stylesheet.

Colours Computed in Code

A generated palette or a data-driven chart produces channel integers at runtime; the hex string is what ends up in the exported theme file.

The same two-digit rule covers the alpha channel that modern CSS allows as a seventh and eighth character, and the per-channel values that image tools report when you sample a pixel.

Building a Hex Colour One Channel at a Time

1

Convert the red channel

Enter the first of the three numbers. Anything above 255 is still converted, but it is no longer a valid eight-bit channel, so keep an eye on the range.

2

Pad short results to two digits

A channel under 16 comes back as a single digit — 5 rather than 05. Write the zero in front yourself, or the six characters will not line up.

3

Join the three pairs

Repeat for green and blue, then assemble the six characters behind a #. Note that the copy button gives you 0x notation, which belongs in code rather than in CSS.

Reading a colour apart: drop a pair such as 8B into the lower field to see the channel value it stands for. Swap opens the hex-first page carrying that pair with it.

RGB Channel Values as Colour Hex

Named CSS colours are a convenient way to check your method, because the specification fixes both forms. Convert each channel below and you should land exactly on the published hex string.

CSS nameRedGreenBlueHex
Tomato2559971#FF6347
DodgerBlue30144255#1E90FF
SeaGreen4613987#2E8B57
Gold2552150#FFD700
SlateGray112128144#708090
Indigo750130#4B0082

Digits Come Back Capitalised

Letters render as A to F, the casing most style guides prefer for hex colours; CSS itself treats both cases the same.

Nudge a Channel and Watch

Because the result follows every keystroke, you can walk a channel up from 240 to 255 and see how little the last pair moves.

Link Straight to a Channel

Adding ?v=139 to the address opens the page with that channel already converted, handy inside a design note.

Colour Code Questions

What hex pair matches 80 percent opacity?

Multiply by 255 first: 0.8 × 255 is 204, and 204 converts to CC. Append it to the six characters for #RRGGBBCC, the eight-digit form modern browsers accept.

When can I use the three-character shorthand?

Only when both digits of each pair are identical, since #1AC expands to #11AACC. Those channels are 17, 170 and 204 — any other value needs all six characters.

Should I paste the hash symbol into the field?

There is no need — a hash is not a hex character, so it never reaches the input. Add it in front of the finished string when you write the rule.

Why is 255 the ceiling for a channel?

Each channel is stored in one byte, and a byte counts from 0 through 255 — exactly the two hex digits FF. Wide-gamut formats use more bits per channel and therefore longer notations.

Can I convert all three channels in one go?

Not as a triple — typing 30144255 would be read as one enormous number. Convert red, green and blue separately, then join the pairs.

0123456789
0123456789ABCDEFabcdef
0x

Named Colour Channels

255 = FF
215 = D7
144 = 90
139 = 8B
112 = 70
30 = 1E

Decimal (Base-10)

How pickers and design specs quote a channel: one number from 0 to 255 for red, green or blue.

Hexadecimal (Base-16)

How the same channel is written for the web: a two-character pair, three of them behind a hash.

Convert red, green and blue one at a time
30, 144, 255 becomes #1E90FF
Pad a single-digit result to two characters yourself
Copying adds 0x, which belongs in code rather than CSS
Want to learn more? Read documentation →
1/5
Start typing to search...
Searching...
No results found
Try searching with different keywords