Design · verktøy

Verktøy for kontroll av fargekontrast

Velg tekst- og bakgrunnsfarger for å se kontrastforholdet og WCAG-resultatet.

Kjøres i nettleseren. Ingen opplasting.
Sample textThe quick brown fox jumps over the lazy dog.
Contrast ratio—
WCAG AA · normal text—
WCAG AA · large text—
WCAG AAA · normal text—

Change either color to check readability. WCAG thresholds are guidance for this color pair only.

Om verktøyet

Verktøy for kontroll av fargekontrast sem complicação.

Kontrollen beregner WCAG-kontrastforholdet for ugjennomsiktige sRGB-farger. Den hjelper med å vurdere tekstlesbarhet, men sertifiserer ikke en hel side og erstatter ikke en tilgjengelighetsrevisjon.

Veiledning

Slik bruker du Verktøy for kontroll av fargekontrast

The Color Contrast Checker compares a text color with a background color and shows their contrast ratio, from 1:1 to 21:1. It then says if the pair passes the WCAG thresholds for normal text at AA, large text at AA and normal text at AAA. You pick both colors with a color picker. It checks only two plain colors, so it cannot say that a whole page is accessible.

Slik gjør du

  1. Click the text color swatch and choose the color of your text. The starting value is a dark blue-grey, #172033.
  2. Click the background color swatch and choose the color behind the text. The starting value is white.
  3. Read the contrast ratio and the three Pass or Does not pass lines. The sample text above them shows the pair.
  4. Change either color until the lines you need say Pass.

Eksempler

The starting colors

Du skriver inn
Tekst
#172033
Bakgrunn
#FFFFFF
Du får
Forhold
16.27:1
AA vanlig tekst
Pass
AA stor tekst
Pass
AAA vanlig tekst
Pass

Dark text on white is far above every threshold, including 7:1 for AAA normal text.

Kjørt med verktøyets egen kode.

Grey that just passes, and grey that just fails

Du skriver inn
Par A
#767676 on #FFFFFF
Par B
#777777 on #FFFFFF
Du får
Par A
Forhold: 4.54:1; AA vanlig tekst: Pass; AA stor tekst: Pass; AAA vanlig tekst: Does not pass
Par B
Forhold: 4.48:1; AA vanlig tekst: Does not pass; AA stor tekst: Pass; AAA vanlig tekst: Does not pass

One step in grey moves the ratio across the 4.5:1 line for normal text. The second grey still passes for large text, which needs only 3:1.

Kjørt med verktøyets egen kode.

Red on white

Du skriver inn
Tekst
#FF0000
Bakgrunn
#FFFFFF
Du får
Forhold
4.00:1
AA vanlig tekst
Does not pass
AA stor tekst
Pass
AAA vanlig tekst
Does not pass

Pure red on white reaches about 4:1. That is enough for large text but not for body text. The ratio is the same if you swap the two colors.

Kjørt med verktøyets egen kode.

A pair that shows 4.50 but does not pass

Du skriver inn
Tekst
#647D66
Bakgrunn
#FFFFFF
Du får
Forhold
4.50:1
AA vanlig tekst
Does not pass
AA stor tekst
Pass
AAA vanlig tekst
Does not pass

The real ratio is about 4.4995. The tool shows two decimals, so it reads 4.50, but it compares the unrounded number with 4.5. WCAG says the computed value is not rounded, so this is correct, though it looks odd.

Kjørt med verktøyets egen kode.

Når det er nyttig

  • Check the color of body text and buttons on a web page design.
  • Pick a lighter or darker shade until a pair reaches the level you need.
  • Check slide or poster colors before printing or presenting.
  • Explain to a team why a light grey on white is hard to read.

Begrensninger

  • It tests two opaque colors only. It cannot judge text over a photo, a gradient, a see-through color or a color that changes on hover.
  • The colors come from the browser's color picker, so you choose a color but cannot type a hex code into the page.
  • It shows AA for normal and large text and AAA for normal text. It does not show the AAA result for large text or any check for user interface parts.
  • It does not decide if your text is large. WCAG counts large text as at least 18 point, or 14 point bold, and it is up to you to know which case applies.

Tips

  • Aim for a little more than the minimum, because small changes in the screen or the font can make a borderline pair harder to read.
  • Contrast is not the only need. Do not use color alone to carry meaning, and test with real users when you can.
  • If a pair fails, move only the darker color darker, or the lighter color lighter, and watch the ratio.

Kilder

Vanlige spørsmål

Sobre Verktøy for kontroll av fargekontrast.

What contrast ratio do I need?

WCAG 2.2 level AA asks for at least 4.5:1 for normal text and 3:1 for large text. Level AAA asks for 7:1 for normal text and 4.5:1 for large text. Logos and purely decorative text have no requirement.

How is the contrast ratio worked out?

It is (L1 + 0.05) divided by (L2 + 0.05), where L1 is the relative luminance of the lighter color and L2 of the darker one. Relative luminance weighs red, green and blue after an sRGB adjustment. The result runs from 1 to 21.

What counts as large text?

WCAG defines large-scale text as at least 18 point, or 14 point and bold. That is about 24 pixels, or about 18.7 pixels bold, in a typical browser. The tool does not ask your font size, so decide this yourself.

Why does the page say Does not pass at 4.50:1?

The display rounds to two decimals, but the test uses the exact number. A pair that is really 4.4995 shows 4.50 and fails AA for normal text. WCAG says not to round up the ratio before comparing.

Does passing mean my website is accessible?

No. It means this one pair of colors meets a rule. Accessibility also depends on layout, text size, controls, keyboard use, images and more. The tool is no substitute for a full accessibility audit.

Can I check text on top of an image?

Not with this tool. It takes one solid text color and one solid background color. For an image, check the worst spot behind the text by sampling its color, or add a solid panel behind the text.

Is my color choice sent anywhere?

No. The ratio is worked out in your browser and the page says nothing is uploaded. Note the hex values yourself if you want to keep them.

Hvordan bruker du Fargekontrastkontroll?

Velg tekst- og bakgrunnsfarger for å se kontrastforholdet og WCAG-resultatet.

Lastes dataene mine opp til en server?

Nei. Behandlingen skjer i nettleseren din, og opplysningene dine lastes ikke opp.