RGB ↔ Hex 转换器

即时切换 RGB 与 Hex 颜色代码,复制任一结果,并查看实时颜色预览。

RGB 转 Hex

输入红、绿、蓝通道值(0–255),即可获得对应的 Hex 代码。

每个通道必须是 0 到 255 之间的整数。

Hex 转 RGB

粘贴 3 位或 6 位的 Hex 颜色即可查看 RGB 表示。

使用 #RRGGBB 或 #RGB 格式,字母大小写不区分。

为什么使用 RGB?

RGB 通过红、绿、蓝三种光的强度来表示颜色,是显示器、LED 以及大多数设计软件的原生格式。

当需要微调对比度、无障碍表现或渐变效果时,分别调整 RGB 通道可以提供精确的控制。

为什么使用 Hex?

Hex 将三个 RGB 通道压缩成六个字符的紧凑代码,便于粘贴到 CSS、设计令牌或代码片段中。

这种格式在不同工具之间容易传递,同时对设计师和开发者都友好易读。

手动转换颜色

按照以下步骤即可手动完成 RGB 与 Hex 的转换。

  • 将每个 RGB 通道写成 0 到 255 之间的数字。
  • 用 16 去除该值:商是第一个十六进制数字,余数是第二个数字。
  • 数值 10–15 对应字母 A–F,将三个二位组合拼成 #RRGGBB。

从 Hex 转到 RGB 时,将字符串按两位拆分,转换为十进制后即可得到各通道值。

What RGB ↔ Hex 转换器 does

RGB ↔ Hex 转换器 is a focused browser tool: 即时切换 RGB 与 Hex 颜色代码,复制任一结果,并查看实时颜色预览。.

Use the controls on this page for RGB ↔ Hex 转换器 and check the output directly. Review results before using them in documents, code or other important contexts.

Related terms for this tool include rgb 转 hex, hex 转 rgb, 颜色转换器, hex 转换器 and rgb 转换器. These terms are used as orientation only; the visible controls and the entered data define what the tool actually does.

Where RGB ↔ Hex 转换器 helps

  • Use RGB ↔ Hex 转换器 when your task involves rgb 转 hex and you need a focused result on the page.
  • Use RGB ↔ Hex 转换器 when your task involves hex 转 rgb and you need a focused result on the page.
  • Use RGB ↔ Hex 转换器 when your task involves 颜色转换器 and you need a focused result on the page.

Using RGB ↔ Hex 转换器 well

  • Start RGB ↔ Hex 转换器 with the visible inputs and change optional fields after the first result is clear.
  • Check whether the RGB ↔ Hex 转换器 output fits rgb 转 hex and your current task before copying it.
  • Run RGB ↔ Hex 转换器 again after changing inputs or browser settings before reusing the result.

FAQ

What is RGB ↔ Hex 转换器 best used for?

RGB ↔ Hex 转换器 is useful when you need this specific task handled quickly: 即时切换 RGB 与 Hex 颜色代码,复制任一结果,并查看实时颜色预览。.

What should I check in RGB ↔ Hex 转换器 before using the result?

Compare the visible output with the labels on the page, especially when your task involves rgb 转 hex, hex 转 rgb, 颜色转换器, hex 转换器 and rgb 转换器.

Why can RGB ↔ Hex 转换器 show an empty or unexpected result?

The most common reasons are missing input, unsupported characters, browser state or changed settings for RGB ↔ Hex 转换器.