◉

Color Converter

Convert colors between HEX, RGB, and HSL formats

—HEX value
—RGB value
—HSL value

Color Converter — what it does

Type a colour in any common notation and this converter returns the equivalent HEX, RGB and HSL values at once. It is the translation layer between design tools that speak hex, CSS that often prefers rgb with alpha, and the HSL notation that makes lightening or shifting a hue a matter of changing one number.

Worked example

Four notations typed into the box one after another and converted with the button; the three cells are what the page showed for each.

InputHEXRGBHSL
#2563eb#2563EBrgb(37, 99, 235)hsl(221, 83.2%, 53.3%)
rgb(230, 126, 34)#E67E22rgb(230, 126, 34)hsl(28, 79.7%, 51.8%)
hsl(150, 60%, 40%)#29A366rgb(41, 163, 102)hsl(150, 60.0%, 40.0%)
#4af#44AAFFrgb(68, 170, 255)hsl(207, 100.0%, 63.3%)

HEX comes back in upper case; hue is rounded to a whole degree and saturation and lightness to one decimal place.

When this tool helps

  • Turning a brand hex code from a style guide into the rgb values a CSS variable or a canvas API call expects.
  • Building a tint and shade scale from one base colour by holding hue and saturation and moving lightness.
  • Reading a colour picked out of a screenshot and recording it in the notation your design system uses.

How to use it

  1. Enter a colour value in the input field.
  2. Press process to convert it.
  3. Read the HEX, RGB and HSL equivalents.
  4. Copy whichever notation your file needs.

Accuracy, limits, and good practice

  • HSL is the practical notation for variations: same hue and saturation with lightness at 30, 50 and 70 percent gives a coherent scale.
  • Three-digit hex shorthand expands by doubling each digit, so #4af is exactly #44aaff and not an approximation.
  • Converted values are exact within rounding, but two colours that match numerically can still look different on uncalibrated displays.

Frequently asked questions

What does the third HSL number mean?

Lightness. Zero is black, 100 percent is white, and 50 percent is the pure hue at the saturation you specified.

Can I convert a named colour?

CSS names map to fixed hex values — tomato is #ff6347, for example — so look up the hex and convert from there.

Why does my printed colour look wrong?

Print uses CMYK, a smaller gamut than screen RGB. Vivid screen colours, especially bright blues and greens, cannot be reproduced exactly in ink.

What happens to the alpha channel in rgba() or hsla()?

It is ignored: rgba(37, 99, 235, 0.5) converts exactly like rgb(37, 99, 235), and none of the three outputs ever includes an alpha value. Add the transparency back by hand after converting.

What does the page do with a value it cannot read?

The status line shows "Please enter valid values." and the three result cells keep whatever the previous conversion produced, so check the status before copying. A colour name such as steelblue, a hex code without the #, or percentages inside rgb() all trigger this.

Related tools on this site

Everything above runs inside this page. Color Converter needs no account, no upload, and no server round trip — close the tab and nothing is left behind.

顏色格式轉換能做什麼

以任何常見格式輸入顏色,轉換器會同時回傳對應的 HEX、RGB 與 HSL 數值。它是設計工具(習慣用 hex)、CSS(常需要含透明度的 rgb)與 HSL(改一個數字就能調亮或位移色相)三者之間的翻譯層。

實際範例

四種寫法依序填進欄位並按下轉換;三個顯示格的內容就是頁面上實際看到的值。

填寫的值HEXRGBHSL
#2563eb#2563EBrgb(37, 99, 235)hsl(221, 83.2%, 53.3%)
rgb(230, 126, 34)#E67E22rgb(230, 126, 34)hsl(28, 79.7%, 51.8%)
hsl(150, 60%, 40%)#29A366rgb(41, 163, 102)hsl(150, 60.0%, 40.0%)
#4af#44AAFFrgb(68, 170, 255)hsl(207, 100.0%, 63.3%)

HEX 一律以大寫回傳;色相四捨五入到整數度,飽和度與亮度保留一位小數。

什麼時候用得上

  • 把品牌規範中的 hex 色碼,換成 CSS 變數或 canvas API 需要的 rgb 數值。
  • 固定色相與飽和度、只調整明度,從單一主色建立一整組深淺階。
  • 讀取從截圖中取得的顏色,並以設計系統慣用的格式記錄下來。

使用步驟

  1. 在輸入欄填入顏色數值。
  2. 按下轉換。
  3. 查看 HEX、RGB 與 HSL 對應值。
  4. 複製檔案中需要的那一種格式。

精確度、限制與實務建議

  • 做變化色時 HSL 最實用:相同色相與飽和度,明度取 30%、50%、70% 就是一組協調的階層。
  • 三位數的簡寫 hex 是把每位重複一次,因此 #4af 精確等於 #44aaff,不是近似值。
  • 轉換值在四捨五入範圍內精確,但數值相同的兩個顏色在未校色的螢幕上仍可能看起來不同。

常見問題

HSL 的第三個數字是什麼?

明度。0 是黑色,100% 是白色,50% 則是你所指定飽和度下的純色相。

可以轉換顏色名稱嗎?

CSS 顏色名稱都對應固定 hex,例如 tomato 是 #ff6347,查到 hex 後再轉換即可。

為什麼印出來的顏色不對?

印刷使用 CMYK,色域比螢幕 RGB 小。螢幕上鮮豔的藍綠色,油墨無法完全重現。

rgba() 或 hsla() 的透明度會怎麼樣?

會被忽略:rgba(37, 99, 235, 0.5) 的轉換與 rgb(37, 99, 235) 完全相同,三個顯示格也從不包含 alpha 值。需要透明度的話,轉換後再自行補上。

填了工具看不懂的值會怎樣?

狀態列會顯示「Please enter valid values.」,三個顯示格則保留上一次轉換的內容,複製前先看一眼狀態列。打 steelblue 這類色名、少了 # 的十六進位碼,或在 rgb() 裡寫百分比,都會觸發這個訊息。

本站相關工具

以上步驟全部在這個頁面內完成,顏色格式轉換 不需要註冊、不上傳檔案、也不經過伺服器,關閉分頁後不會留下任何資料。