Design ToolsA little help for every day

Search by name or task, such as JSON or percentage.

Design Tools

HEX to RGB and RGB to HEX Converter

Convert HEX colour codes to RGB and back. Handles 3, 4, 6 and 8-digit HEX with alpha, rgb() or plain 26, 115, 232 values, and up to 200 colours at once.

View all tools
ResultUpdates as you type
InputHEXRGBHSL
#1a73e8#1a73e8rgb(26, 115, 232)hsl(214, 82%, 51%)
rgb(255, 87, 51)#ff5733rgb(255, 87, 51)hsl(11, 100%, 60%)
#fff8#ffffff88rgba(255, 255, 255, 0.533)hsla(0, 0%, 100%, 0.533)

How to use HEX to RGB and RGB to HEX Converter

Type one colour per line, as HEX with or without the #, rgb(), rgba(), hsl() or three plain numbers. A single colour shows HEX, RGB, HSL, channels and a decimal value; several lines give a table you can copy.

  1. Enter colours, one per lineMix formats freely: #1a73e8, 1a73e8, rgb(255, 87, 51) and 255, 87, 51 all work.
  2. Pick the output styleTick Upper-case HEX for capitals, or space-separated rgb() for the modern rgb(26 115 232) syntax.
  3. Copy the resultsCopy single values from the cards or the whole table. Unrecognised lines are listed in a warning.

How HEX maps to RGB

A six-digit HEX code holds three pairs of base-16 digits for red, green and blue, each from 00 to ff, or 0 to 255. In #1a73e8, 1a is 1 × 16 + 10 = 26, 73 is 115 and e8 is 232, so the colour is rgb(26, 115, 232). Going the other way, each channel is written as two hex digits, so rgb(255, 87, 51) becomes #ff5733. A single colour also gets a decimal integer, the 0xRRGGBB value read as one number, which is 1733608 for #1a73e8; some APIs and game engines take colours in that form.

Shorthand, alpha and out-of-range values

Three-digit shorthand doubles each digit, so #f80 is #ff8800. Eight-digit HEX carries alpha in the last pair: #1a73e880 is rgba(26, 115, 232, 0.502), because hex 80 is 128 and 128 ÷ 255 ≈ 0.502. Four-digit shorthand works the same way, so #fff8 is rgba(255, 255, 255, 0.533). In reverse, rgba(0, 0, 0, 0.5) becomes #00000080. Values outside 0 to 255, such as rgb(300, 0, 0), are clamped the way browsers do it and flagged with a warning, so you know the input was off.

Accuracy and data handling

Review colours, dimensions and visual settings in the real component, type size and target display. The calculation runs in your current browser; the tool code does not send the input to a processing API.

FAQ

How do I convert HEX to RGB?

Split the six digits into three pairs and convert each from base 16 to base 10: #1a73e8 gives 26, 115 and 232, so rgb(26, 115, 232). Typing the code here does it instantly.

How do I convert RGB to HEX?

Write each channel as two hex digits and join them. Enter rgb(255, 87, 51) or just 255, 87, 51 and you get #ff5733.

Can I convert a list of colours at once?

Yes. Put one colour per line, up to 200. The results come back as a table with HEX, RGB and HSL columns, and any line that isn't recognised is listed separately.

More Design Tools

Related tools