How to use the Hex Color Formatter & Converter
Convert your hex colors in four steps:
Enter hex color values
Type or paste one or more hex colors into the input. Accepts 3-digit (#abc), 6-digit (#aabbcc), and 8-digit (#aabbccff) hex values, with or without the # prefix. Multiple colors can be pasted on separate lines or extracted from a block of CSS.
Choose output format
Select the output format: RGB, RGBA, HSL, HSLA, or CSS custom property. Toggle uppercase or lowercase hex output and choose whether to include the # prefix.
Review results and WCAG contrast
Each color is shown with a visual swatch, its converted value, and WCAG contrast ratios against black and white. AAA, AA, and Fail badges indicate accessibility compliance.
Copy or download
Copy individual converted values or download all results as a text or CSS file for use in your project.
When to use this tool
Use the hex color formatter whenever you need to work with CSS color values:
- →Converting a brand hex color to RGB or HSL for use in CSS custom properties or design tokens
- →Checking WCAG AA/AAA contrast compliance for text and background color combinations
- →Normalising inconsistent hex values (mixed 3-digit and 6-digit) in a design system stylesheet
- →Extracting all hex colors from a CSS file and batch-converting them to a consistent format
- →Generating CSS variable declarations (--color-primary: #1a6b4a) from a hex color palette
- →Identifying if a hex color can be shortened to its 3-digit equivalent without quality loss
- →Converting 8-digit hex values (with alpha) to their RGBA equivalents for browser compatibility