RGB to HEX Converter — Free Color Converter for HSL, CMYK & CSS Colors

Free online RGB to HEX converter and color code converter. Convert colors between HEX, RGB, HSL, HWB, LCH, CMYK and CSS color names instantly — 100% offline.

To convert RGB to HEX or HEX to RGB, type a color into any field, such as HEX, RGB or HSL; all other formats, including CMYK and the color name, update instantly.

Last updated:

RGB to HEX Converter — Free Color Converter for HSL, CMYK & CSS Colors. Free online RGB to HEX converter and color code converter. Convert colors between HEX, RGB, HSL, HWB, LCH, CMYK and CSS color names instantly — 100% offline.

Convert between color formats instantly with our free online RGB to HEX converter . Enter any color in HEX ( #ff0000 ), RGB ( rgb(255,0,0) ), HSL ( hsl(0,100%,50%) ), HWB, LCH, CMYK, or CSS color name — and get all other formats updated in real time.

Perfect for web developers converting design tokens, CSS variables, and Tailwind colors; graphic designers translating between screen and print color spaces; and UI engineers matching brand guidelines across platforms.

Our rgb to hex tool and color code converter are powered by the colord library and run entirely in your browser — no server upload, no data logging. Need a HEX code as an rgba() value with opacity? Use the dedicated HEX to RGB converter .

When do you need color conversion? CSS and HTML use HEX color codes like #1ea54c . JavaScript and canvas APIs often require rgb(30, 165, 76) . Design tools like Figma and Adobe XD export HSL values which are easier to reason about (hue, saturation, lightness).

Print workflows use CMYK . Our tool converts between all of these simultaneously — type in any format and every other field updates instantly.

HEX to HSL is one of the most searched but least-served conversions: just type your hex code and get the HSL output immediately. The color picker lets you visually choose a color and see all its representations at once.

All conversion happens client-side using the colord library — your brand colors and design palettes stay private.

Frequently asked questions

How do I convert RGB to HEX?

Type or paste the RGB value, for example rgb(255, 0, 0), into the RGB field. The HEX field immediately shows #ff0000, and the HSL, HWB, LCH, CMYK and Name fields update too. Use the copy icon next to a field to copy that value.

How do I convert a HEX color code to RGB or HSL?

Enter the HEX code in the HEX field including the # sign, for example #1ea54c. Three, four, six and eight digit codes work (the last two include transparency). The RGB and HSL fields then show the same color, ready to copy into your CSS.

Which color formats does the converter support?

HEX, RGB, HSL, HWB, LCH, CMYK and CSS color names, plus a visual color picker. Each field accepts any of these notations, so pasting red or hsl(0, 100%, 50%) into any box converts it to every other format.

Why does the Name field show a different color name?

The Name field shows the closest standard CSS color keyword. If your color is not exactly one of the named CSS colors, the nearest one is displayed, so treat the name as an approximation rather than an exact match.

Is the CMYK value accurate for printing?

The CMYK value is a simple mathematical conversion from RGB with no ICC color profile. It is a good starting point, but printed colors depend on the printer, paper and profile, so ask your print shop for profile-based values for critical brand colors.

Why do I see an invalid format message?

The text could not be read as a color. Common causes are a HEX code without the # sign, the wrong number of digits, or a missing parenthesis. Follow the placeholder in each field, such as hsl(0, 100%, 50%) or cmyk(0, 100%, 100%, 0).

How to use this online tool

RGB to HEX Converter — Free Color Converter for HSL, CMYK & CSS Colors is designed for fast browser workflows when you need to format, validate, convert, decode, encode, generate, or inspect data without opening a heavy desktop app. Start with the input field or visible options, review the result, then copy or download the output for the next step.

Private processing in your browser

RGB to HEX Converter — Free Color Converter for HSL, CMYK & CSS Colors keeps the normal processing step local in your browser. That is useful for code snippets, tokens, documents, configuration values, text samples, and other material that should not be sent to a remote service unless you explicitly choose to share it.

When this tool is useful

Use RGB to HEX Converter — Free Color Converter for HSL, CMYK & CSS Colors for repeatable developer tasks, technical documentation, QA checks, quick conversions, debugging, content cleanup, and internal team workflows. The page focuses on clear inputs, immediate feedback, and output that is easy to reuse in code, reports, tickets, emails, or notes.

Practical tips

Before copying the final result, check important details such as spacing, casing, filenames, encoding, token structure, line breaks, or output format. Small checks prevent mistakes when the result is reused in source code, API requests, documentation, spreadsheets, or shared files.