Three channels, three spellings
Convert a color
The same color is written as hex, RGB, or HSL depending on the file. This page parses one of those forms and prints the other two.
#rgb is expanded by doubling each digit. #rrggbb is read as three bytes. rgb() accepts commas or spaces. hsl() accepts degrees and percentages. Alpha is not kept. A channel outside 0–255 is rejected. The swatch is the parsed hex, not a style string taken from the input.
The conversion stays in this tab.
This tool runs in your browser. Turn on JavaScript to use it.
The green used on this site
The hex and the rgb() form are the same three bytes.
- Hex
- #1e4d3a
- RGB
- rgb(30, 77, 58)
How to use it
- 1Paste #rgb, #rrggbb, rgb(), or hsl().
- 2Read the other spellings and the swatch.
- 3Copy the form your stylesheet uses.
Good to know
- No alpha channel.
- Eight-digit hex is not accepted.
- The swatch uses the parsed color only.
Questions
Why was #1e4d3aff rejected?
The page does not read an alpha byte. Use six digits or three.
Are HSL degrees exact?
They are rounded to whole numbers, then converted back. A round trip can move a channel by one.
Can I name a color, such as pine?
No. CSS color names are not looked up.
Related tools
- Convert px and rem
rem is relative to the root font size, not to the parent. This page divides or multiplies by the root you set.
- Encode text as hexadecimal
Hex is a way to show raw bytes. This page encodes text as UTF-8 first, then prints each byte. Decoding accepts only an even number of digits and rejects bytes that are not UTF-8.
- Convert binary, octal, decimal, and hex
255, 0xFF, and 11111111 are one integer written three ways. This page keeps that integer exact and shows the other spellings beside the field you edit.