Development and data

How to convert a color between HEX and RGB

HEX and RGB can express the same three color channels in different formats, useful when reviewing an interface.

Before you start

Text is processed in the browser. Consider the content before using it and read the privacy policy.

Privacy

How to use it

  1. Enter #1a2b3c and convert.

  2. Check the three RGB channel values.

  3. Enter rgb(256,0,0): the out-of-range value is rejected.

Color Converter

Worked example

The hexadecimal pairs 1a, 2b and 3c correspond to 26, 43 and 60 in decimal.

Result: #1a2b3c → rgb(26, 43, 60).

Limits and checks

It accepts three- or six-digit HEX and rgb() with three integers from 0 to 255. Alpha, percentages, CSS names and many other color formats are unsupported; it does not assess contrast or accessibility.

Next step

To prepare an address value, see the URL component guide.

How to encode a value for a URL component
Back to the blog