PDF & image

How to Convert Colours and Check Text Contrast

Convert HEX, RGB and HSL, interpret approximate CMYK and check white or black contrast. Includes two worked examples and the limits of WCAG pass badges.

By the Criza Labs team · Updated · 5 min read

Key takeaways

  • HEX, RGB and HSL represent the same supported opaque sRGB colour.
  • CMYK values are approximate because the tool does not use a printer profile.
  • Contrast badges use full-precision ratios and check only white or black pairings.

The colour converter translates an opaque sRGB colour into HEX, RGB, HSL and approximate CMYK forms. It also checks the colour’s contrast against white and black. Use it to move a colour between design notes and CSS, or to inspect a proposed text colour before checking the complete page in context.

Keep representation, appearance and accessibility separate. Different strings can describe the same supported colour. The same colour can look different on different displays or beside different surroundings. A contrast badge tests one numerical pairing and does not certify a whole design, document or website.

Before you start

Choose a supported input format. The text field accepts three- or six-digit HEX, comma-separated RGB numbers, HSL with percentage saturation and lightness, or CMYK with four percentages. Examples are #F00, rgb(255, 0, 0), hsl(0, 100%, 50%) and cmyk(0%, 100%, 100%, 0%).

Alpha transparency, named colours and wider-gamut colour spaces are outside this interface’s scope. If a source colour is translucent, first determine the actual composite against its intended background in a suitable design workflow. Comparing its opaque RGB channels alone would not describe the visible text-background pairing.

The native picker is another input route, useful when you want to explore a colour visually. Its appearance depends on your browser and operating system. The adjacent text field remains useful for exact reproducible values, which you can record with a design decision or share with another person reviewing the same candidate.

Step by step with CrizaTools

  1. Open Colour Converter and enter a supported value under Colour value.
  2. Correct any format error beside the field. HSL saturation and lightness require percent signs, and CMYK requires four percentages.
  3. Alternatively use Colour picker to choose a value. It updates the colour text and conversions.
  4. Read the swatch and the HEX, RGB and HSL results. Copy the representation required by your destination.
  5. Read CMYK (approximate) only as a mathematical estimate, and use its copy button if that estimate is useful.
  6. Inspect Against white and Against black. Each shows a ratio and separate AA/AAA pass or fail badges for normal and large text.
  7. Check the actual design’s background, text size and states separately. The tool’s fixed white and black pairings may differ from your real interface.

Two worked examples

Example 1: pure red. Enter #FF0000, or the shorter #F00. The converter reports rgb(255, 0, 0) and hsl(0, 100%, 50%). Its mathematical CMYK estimate is cmyk(0%, 100%, 100%, 0%).

Against white, the contrast ratio is approximately 4.00:1. That fails AA for normal text, while passing the lower AA threshold for large text. Against black, the ratio is approximately 5.25:1: it passes AA for normal text but fails AAA for normal text. The same colour can therefore produce different badges depending on its paired background.

Example 2: black and the maximum opaque contrast. Enter rgb(0, 0, 0). The outputs include #000000, hsl(0, 0%, 0%) and approximate cmyk(0%, 0%, 0%, 100%). The CMYK calculation handles black explicitly rather than dividing by zero when every RGB channel is zero.

Against white, black has 21:1 contrast and passes the displayed normal and large-text thresholds. Against black, the same black input has 1:1 contrast and fails all of them. A value of 1:1 means the two colours have the same relative luminance, not that the text is faintly distinguishable by the contrast formula.

Limits and what to watch for

The converter uses integer RGB channels from 0 to 255. HSL hue wraps around the colour wheel, while saturation and lightness must lie between 0% and 100%. RGB inputs with fractional channels are rounded to byte values. Output HSL and CMYK percentages are rounded for readability, so repeated conversion can introduce small numerical differences.

HEX, RGB and HSL describe the supported sRGB colour through different coordinates. The CSS Color specification documents these colour representations; checked 16 November 2026. This interface accepts a deliberately limited input syntax rather than every colour expression permitted in CSS.

CMYK output uses a simple mathematical conversion without ink, paper or printer profiles. It cannot predict a production print match. If a printer requests a particular profile, use colour-managed software and that printer’s requirements. The approximate label applies both to CMYK output and to colours entered as percentage CMYK.

For contrast, WCAG AA normal text requires at least 4.5:1 and AAA requires 7:1. Large text uses 3:1 for AA and 4.5:1 for AAA. WCAG defines large text as at least 18 pt regular or 14 pt bold. See WCAG 2.2 contrast minimum and contrast enhanced, checked 16 November 2026.

Badges compare the unrounded ratio with each threshold. A displayed 4.50 can still fail if the underlying value is slightly below 4.5. The rounded text is a convenient summary, while the comparison must retain the precise value. Never round a failing ratio upward yourself to claim a pass.

Common mistakes

  • Treating approximate CMYK as a printer-ready colour specification.
  • Entering an eight-digit HEX value and overlooking its alpha channel.
  • Omitting percentage signs from HSL saturation or lightness.
  • Reading the white-background result when the real background is another colour.
  • Applying large-text thresholds to ordinary body text.
  • Assuming one passing badge verifies focus states, hover states or every other accessibility requirement.

Questions and answers

Can I enter HEX without the hash sign?

Yes. Three- and six-digit HEX values work with or without it. A three-digit value repeats each digit, so F00 expands to FF0000. Output uses the full six-digit form with a leading hash.

Why does CMYK always say approximate?

The calculation has no printer profile and does not model actual inks or paper. It provides a rough numerical correspondence, not a guarantee of printed appearance. Use a colour-managed production workflow when a physical match matters.

Can the picker choose transparent colours?

This tool handles opaque colours only. If transparency is part of your design, determine the resulting composite against the intended background and check that pairing separately rather than ignoring the alpha channel.

Why can a ratio displayed as 4.50 fail AA normal text?

The underlying ratio may be below 4.5 even though rounding to two decimal places displays 4.50. Badges use the full precision result, so rounding cannot turn a failing comparison into a passing one.

Does a passing badge certify my website?

No. It applies only to this opaque colour paired with white or black and the stated text-size class. Actual pages require checks of real backgrounds, typography, interaction states and the other applicable accessibility criteria.

Sources

Compare values with Colour Converter and prepare raster assets with Image Resize and Crop.

Free tools for this

PDF & image

Colour Converter

Convert HEX, RGB and HSL colours, estimate CMYK, and check contrast against white or black with WCAG AA and AAA badges.

PDF & image

Image Resize and Crop

Resize images by pixels or percentage, crop with a movable box and export JPG, PNG or WebP.

PDF & image

Image Compressor

Compress and resize JPG, PNG and WebP images in your browser for websites, upload forms, email and WhatsApp.

More guides

Free desktop app from Criza Labs

Bill every day? Get CrizaVoise free

GST invoices, thermal receipts, stock and payments in one offline app for Windows, Linux and macOS. No subscription, no sign-up, no ads, and your data stays on your computer.

  • 58 mm and 80 mm thermal printing
  • UPI QR on every invoice, WhatsApp sharing
  • Open source (Apache 2.0), English, Hindi, Gujarati and more
The CrizaVoise dashboard with quick bill and new invoice buttons, stock alerts and sample figures