개발자

색상 대비 검사기 (WCAG)

전경·배경 명암비를 계산하고 WCAG AA/AAA를 판정

21.00:1

큰 텍스트 샘플 Aa

Large text sample Aa

일반 텍스트 샘플입니다. 이 문장으로 가독성을 확인하세요.

This is a normal text sample. Check readability with this sentence.

모든 계산은 브라우저에서만 처리되며 서버로 전송·저장되지 않습니다.All calculations run entirely in your browser — never uploaded or stored.

색상 대비 검사기란?

색상 대비 검사기는 전경색(텍스트)과 배경색 두 가지 색상의 명암비(contrast ratio)를 계산해 WCAG 2.1 접근성 기준을 통과하는지 즉시 확인하는 도구입니다. 색상 코드를 입력하거나 색상 선택기로 고르면 명암비와 실시간 미리보기가 바로 반영됩니다.

WCAG 기준 설명
  • 일반 텍스트: AA 4.5:1 이상, AAA 7:1 이상
  • 큰 텍스트(18pt 이상 또는 굵게 14pt 이상): AA 3:1 이상, AAA 4.5:1 이상
참고: sRGB 상대 휘도 공식을 사용해 계산하며, 명암비는 1:1(대비 없음)부터 21:1(흑백 최대 대비)까지의 값을 가집니다.
개인정보·처리 방식

모든 계산은 사용자의 브라우저 안에서만 이루어집니다. 입력한 색상값은 서버로 전송되거나 저장되지 않습니다.

대비율은 어떻게 계산되나요? — 상대 휘도의 원리

명암비 계산은 사람이 색을 인식하는 방식에 가까운 상대 휘도(relative luminance)를 먼저 구하는 데서 시작합니다. R·G·B 각 채널값(0~255)을 255로 나눈 뒤, 값이 0.03928 이하면 선형으로, 초과하면 감마 보정 공식 ((값+0.055)÷1.055)^2.4로 변환합니다. 이렇게 얻은 세 채널 값에 0.2126×R + 0.7152×G + 0.0722×B 가중치를 곱해 더하면 상대 휘도가 나오는데, 초록(G) 채널의 가중치가 압도적으로 큰 이유는 사람 눈의 원추세포가 초록색 파장 변화에 가장 민감하기 때문입니다. 두 색의 상대 휘도가 정해지면 (더 밝은 휘도+0.05)÷(더 어두운 휘도+0.05)로 명암비를 계산하며, 이 도구는 이 공식을 자바스크립트로 그대로 구현합니다.

회색 텍스트, 왜 특히 조심해야 할까 — 통과·실패 실례 검산

실무에서 접근성 기준에 가장 자주 걸리는 색은 의외로 극단적인 색이 아니라 중간 톤 회색 텍스트입니다. 눈으로 보기엔 충분히 진해 보여도 계산해보면 기준에 못 미치는 경우가 많습니다. 예를 들어 흰 배경(#ffffff) 위에 #999999 회색 텍스트를 올리면 명암비는 2.85:1로 일반 텍스트 AA 기준 4.5:1에 크게 못 미쳐 실패합니다. 같은 배경에 조금 더 어두운 #767676을 쓰면 명암비가 4.54:1로 올라 AA 기준을 근소하게 통과합니다. 위 도구에 두 조합을 직접 입력해 배지가 실패→통과로 바뀌는 것을 확인해 보세요. 이렇게 회색은 조금만 밝기를 조정해도 통과 여부가 뒤바뀌므로, 디자인 시안의 회색 텍스트는 감으로 판단하지 말고 항상 계산해서 확인하는 것이 안전합니다.

What is this tool?

The color contrast checker computes the contrast ratio between a foreground (text) color and a background color, and instantly checks whether it passes WCAG 2.1 accessibility thresholds. Type a hex code or pick a color, and the ratio and live preview update immediately.

WCAG thresholds
  • Normal text: AA ≥ 4.5:1, AAA ≥ 7:1
  • Large text (18pt+ or bold 14pt+): AA ≥ 3:1, AAA ≥ 4.5:1
Note: Calculated using the sRGB relative luminance formula; ratios range from 1:1 (no contrast) to 21:1 (max black/white contrast).
Privacy & processing

Everything runs in your browser. Color values are never uploaded or stored.

How is the ratio calculated? — the relative luminance principle

Contrast calculation starts with relative luminance, a value closer to how humans perceive brightness. Each R·G·B channel (0–255) is divided by 255, then converted linearly if ≤0.03928 or via the gamma-correction formula ((value+0.055)÷1.055)^2.4 otherwise. The three results are combined with weights 0.2126×R + 0.7152×G + 0.0722×B — green dominates because human cone cells are most sensitive to green wavelength changes. Once both colors have a relative luminance, the ratio is (lighter+0.05)÷(darker+0.05), the exact formula this tool implements in JavaScript.

Why gray text needs extra care — a pass/fail worked example

The color that trips up accessibility checks most often in practice isn't an extreme color — it's mid-tone gray text. It can look dark enough by eye while still falling short when calculated. On a white background (#ffffff), #999999 gray text gives a ratio of 2.85:1, well under the 4.5:1 AA threshold for normal text — a fail. Darkening it slightly to #767676 on the same background raises the ratio to 4.54:1, narrowly clearing AA — a pass. Try both combinations in the tool above and watch the badge flip from fail to pass. Because a small brightness tweak can flip the result, gray text in a design mockup should always be calculated, never eyeballed.

WCAG 명암비는 어떻게 계산되나요?
먼저 각 색상의 sRGB 채널값을 상대 휘도(relative luminance)로 변환한 뒤, 두 색상 중 더 밝은 휘도에 0.05를 더한 값을 더 어두운 휘도에 0.05를 더한 값으로 나눕니다. 결과는 1:1(대비 없음)부터 21:1(흑백 최대 대비) 사이의 값입니다.
AA와 AAA 기준의 차이는 무엇인가요?
AA는 최소 접근성 기준으로 일반 텍스트 4.5:1, 큰 텍스트 3:1 이상을 요구합니다. AAA는 더 엄격한 기준으로 일반 텍스트 7:1, 큰 텍스트 4.5:1 이상을 요구합니다. 공공기관·법적 요구사항이 있는 경우 AA 이상을 권장합니다.
큰 텍스트 기준은 어떻게 정의되나요?
WCAG에서 큰 텍스트는 18pt(24px) 이상, 또는 굵게(bold) 처리된 14pt(약 18.66px) 이상의 텍스트를 의미합니다. 큰 텍스트는 작은 텍스트보다 완화된 명암비 기준이 적용됩니다.
입력한 색상이 서버로 전송되나요?
아니요. 모든 계산은 브라우저 안에서 자바스크립트로 즉시 처리되며, 색상값은 서버로 전송되거나 저장되지 않습니다.
명암비는 구체적으로 어떤 원리로 계산되나요?
sRGB 채널값(R·G·B 0~255)을 0.03928 기준으로 선형 구간과 감마 보정 구간으로 나눠 계산한 뒤, 0.2126×R + 0.7152×G + 0.0722×B 가중합으로 상대 휘도를 구합니다. 초록(G) 채널의 가중치가 가장 큰 이유는 사람 눈이 초록색 변화에 가장 민감하기 때문입니다.
회색 텍스트를 쓸 때 특히 주의해야 하는 이유는 무엇인가요?
회색은 흰 배경과의 명암비가 얼핏 충분해 보여도 실제로는 기준에 못 미치는 경우가 잦은 색입니다. 예를 들어 흰 배경(#ffffff) 위 #999999 텍스트는 명암비가 약 2.85:1로 AA 일반 텍스트 4.5:1에 미달하지만, 같은 배경에 #767676을 쓰면 약 4.54:1로 기준을 통과합니다.
How is the WCAG contrast ratio calculated?
Each color's sRGB channel values are converted to relative luminance, then the lighter luminance plus 0.05 is divided by the darker luminance plus 0.05. The result ranges from 1:1 (no contrast) to 21:1 (max black/white contrast).
What's the difference between AA and AAA?
AA is the minimum accessibility standard, requiring 4.5:1 for normal text and 3:1 for large text. AAA is stricter, requiring 7:1 for normal text and 4.5:1 for large text. AA or higher is recommended for public or legally regulated sites.
How is "large text" defined?
WCAG defines large text as 18pt (24px) or larger, or bold text at 14pt (about 18.66px) or larger. Large text gets a relaxed contrast threshold compared to normal text.
Are entered colors sent to a server?
No. All calculations run instantly in your browser via JavaScript; color values are never transmitted or stored.
What exactly is the math behind the contrast ratio?
Each sRGB channel (R·G·B, 0–255) is converted using a linear or gamma-correction formula depending on whether it's above or below 0.03928, then combined as a weighted sum of 0.2126×R + 0.7152×G + 0.0722×B for relative luminance. Green carries the largest weight because human eyes are most sensitive to changes in green.
Why does gray text need extra caution?
Gray often looks dark enough against a white background but falls short when calculated. For example, #999999 text on white (#ffffff) gives about 2.85:1, failing the 4.5:1 AA threshold for normal text, while a slightly darker #767676 gives about 4.54:1, passing.