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.
#1E90FF.When the Picker Is Not There
Specs Written in RGB
Colours Computed in Code
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
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.
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.
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.
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 name | Red | Green | Blue | Hex |
|---|---|---|---|---|
| Tomato | 255 | 99 | 71 | #FF6347 |
| DodgerBlue | 30 | 144 | 255 | #1E90FF |
| SeaGreen | 46 | 139 | 87 | #2E8B57 |
| Gold | 255 | 215 | 0 | #FFD700 |
| SlateGray | 112 | 128 | 144 | #708090 |
| Indigo | 75 | 0 | 130 | #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.
No comments yet. Be the first to comment!