Convert a hex colour to its red, green and blue channels, including the shorthand and alpha forms defined by the CSS specification.
CSS color
rgb(99 102 241)
Red
99
Green
102
Blue
241
Alpha
1
R = int(hex[0:2], 16), G = int(hex[2:4], 16), B = int(hex[4:6], 16)
A hex colour is just three bytes written in base sixteen, one per channel, which is why #ff0000 is pure red and #000000 is black. The shorthand catches people out: #123 is not a darker version of anything, it is literally #112233, because the specification expands each digit by duplicating it rather than padding it with a zero. Everything is parsed in your browser.
R = int(hex[0:2], 16), G = int(hex[2:4], 16), B = int(hex[4:6], 16)
Each pair of hex digits becomes a number from 0 to 255. A fourth pair, when present, is the alpha channel and is divided by 255 to give the 0 to 1 value that CSS expects.
A number that disagrees with its source is a defect, not a rounding preference.
What did you enter, what did the tool show, and what did you expect instead? If you have a source that disagrees with ours, a link to it is the most useful thing you can send.
Opens your mail app with the page and tool already filled in.
Build a CSS gradient and copy the exact declaration. Angles follow the CSS specification, where 0deg points up and angles turn clockwise.
Convert PNG images to WebP without losing transparency. Everything runs in your browser, so nothing is uploaded and nothing is stored.