# "Links rely on color to be distinguishable": how to fix it

**Audit ID:** `link-in-text-block` · **Category:** Accessibility

<!--QA-->
> **Quick answer:** Lighthouse flags "Links rely on color to be distinguishable" when a link inside a block of text has no underline or other non-color styling and its color has less than 3:1 contrast with the surrounding text. Fix it by underlining links in body text with text-decoration: underline, or give them a bottom border.
<!--/QA-->

Lighthouse prints **Links rely on color to be distinguishable** when a link inside a sentence or paragraph looks like the text around it except for its color, and that color is too close to the text color to notice. A reader with low vision or color blindness, or anyone on a washed-out screen, cannot tell where the link is. The audit comes from the axe-core rule `link-in-text-block` and maps to WCAG 2 success criterion 1.4.1, Use of Color (Level A). It carries a weight of 7 in the Accessibility score, the same as [color contrast](/audits/color-contrast). This page covers what the rule measures, why removing underlines triggers it, and the one-line CSS fix.

## TL;DR

- **What:** A link in a block of text has no underline or other non-color styling, and its color has less than 3:1 contrast with the surrounding text.
- **Why it matters:** Color is the only cue that the words are a link. People who cannot see that color difference miss the link.
- **Fix:** Underline links inside body text: `text-decoration: underline`. Keep the underline off navigation, buttons and cards if you like, since the rule only looks at links inside text.

## What does "Links rely on color to be distinguishable" mean?

The rule checks every `<a href>` and `[role="link"]` element that has visible text and sits **inline inside a block of other text**, such as a link in the middle of a paragraph or list item. A link that stands alone, such as a navigation item, a button-style link or a card title, is not checked.

For each of those links, axe-core asks two questions. The link passes if the answer to either one is yes.

| Check | Passes when |
|---|---|
| Is it styled differently from the text around it? | The link has an underline or other `text-decoration` the surrounding text does not have, a visible bottom border, top border or outline, a background image, or a different font weight, font style, font size or font family |
| Is the color difference strong enough? | The link color has at least **3:1** contrast with the color of the surrounding text, or the link background has at least 3:1 contrast with the surrounding background |

When both answers are no, the audit lists the link with a line like this:

```
The link has insufficient color contrast of 2.27:1 with the surrounding text.
(Minimum contrast is 3:1, link text: #0066cc, surrounding text: #333333)
```

The contrast here is between the **link and the text next to it**, not between the link and the page background. That second ratio is the job of the [color-contrast](/audits/color-contrast) audit, which wants 4.5:1 for normal text.

## Why does my site fail it?

Almost always because a stylesheet removed the underline from links and nothing replaced it:

- **A CSS reset or theme rule:** `a { text-decoration: none; }` applied to every link on the site, including links in body copy.
- **Bootstrap 4 and older themes built on it:** links have no underline until hover. Bootstrap 5 underlines links by default.
- **A design system with "clean" links:** brand blue on dark gray text. The blue looks distinct to the designer and measures under 3:1.
- **Rich text from a CMS:** the editor outputs plain `<a>` tags and the theme styles them with color only.
- **Footers and legal copy:** small gray text with slightly lighter or darker gray links.

Some common pairs and how they measure:

| Link color | Text color | Contrast | Result without an underline |
|---|---|---|---|
| `#0000ee` (browser default blue) | `#000000` | 2.23:1 | Fails |
| `#0066cc` | `#333333` | 2.27:1 | Fails |
| `#0b57d0` | `#1a1a1a` | 2.73:1 | Fails |
| `#2563eb` | `#111827` | 3.43:1 | Passes |
| `#d93025` | `#000000` | 4.40:1 | Passes |

A hover underline does not help. Lighthouse tests the page as loaded, with no pointer over anything, and touch screens have no hover at all.

## How do I fix "Links rely on color to be distinguishable"?

### 1. Underline links inside text (recommended)

Scope the rule to the containers that hold running text, so navigation and buttons keep their look:

```css
main p a,
main li a,
article a,
.prose a {
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: from-font;
}
```

`text-underline-offset` and `text-decoration-thickness` let you tune the line so it does not cut through descenders. Any underline passes, including a dotted or wavy one, because the rule compares `text-decoration-line` and `text-decoration-style` with the surrounding text.

### 2. Use another non-color cue

If the design rules out underlines, any of these also pass:

```css
/* A bottom border instead of an underline */
.prose a { text-decoration: none; border-bottom: 1px solid currentColor; }

/* A heavier weight than the paragraph text */
.prose a { font-weight: 700; }
```

A bottom border is the safest substitute, because readers already read it as a link. Bold alone passes the audit, but bold text is also used for emphasis, so it is a weaker signal.

### 3. Or reach 3:1 against the surrounding text

You can keep color as the only cue if the link color has 3:1 contrast with the text color. In practice this is hard, because the link also needs 4.5:1 against the background to pass the color-contrast audit, and the two requirements pull in opposite directions:

- With **black** text on a white page, the link color has to sit in a narrow band of brightness. `#d93025` works: 4.40:1 against the text and 4.77:1 against white.
- With **`#333333`** text on a white page, no color meets both. A color bright enough for 3:1 against the text is too bright for 4.5:1 against white.

WCAG's own technique for color-only links (G183) also asks for a second cue, such as an underline, when the link is hovered or focused. If you take this route, add one.

For most sites the underline is less work and helps more people.

## How do I fix it in WordPress, Shopify, Tailwind, or Bootstrap?

- **WordPress (block themes):** in `theme.json`, set `styles.elements.link.typography.textDecoration` to `"underline"`. In a classic theme, add `.entry-content a { text-decoration: underline; }` under Appearance, Customize, Additional CSS.
- **Shopify:** rich text from the editor renders inside `.rte`. Add `.rte a { text-decoration: underline; }` to the theme CSS. Custom sections that output plain `<a>` tags outside `.rte` need the same rule on their own container.
- **Tailwind CSS:** Preflight resets links to inherit both color and decoration, so a link you only colored (`text-blue-600`) has no underline. Add the `underline` class, or wrap long-form content in the typography plugin's `prose` class, which underlines links.
- **Bootstrap 4:** add `p a, li a { text-decoration: underline; }`, or upgrade to Bootstrap 5, where underlined links are the default.
- **React and component libraries:** check the `Link` component's defaults. Many expose an `underline` prop set to `hover` or `none`. Set it to `always` for inline links.

## Does a link that looks exactly like the text pass?

Yes, and that is a gap worth knowing. If a link has the same color and the same styling as the text around it, the rule passes it: the link does not rely on color, because nothing sets it apart at all. A fully reset link, such as an unstyled link under Tailwind's Preflight, is invisible to readers and still green in Lighthouse. Passing this audit does not prove your links are findable. Look at the page.

The rule also cannot judge some cases and reports them for manual review instead of failing them: links over a background image or gradient, and links that draw their underline with a `::before` or `::after` pseudo-element. Lighthouse does not count those as failures.

## How do I verify the fix?

1. Re-run Lighthouse. "Links rely on color to be distinguishable" should move to the passed audits.
2. Run the axe DevTools browser extension on a page with long body text. It reports the same rule with the measured ratio for each link.
3. Check with your eyes: view the page in grayscale (DevTools, Rendering panel, Emulate vision deficiencies, Achromatopsia). Every link in body text should still be obvious.
4. Check templates the first run did not cover: blog posts, product descriptions, policy pages and the footer.

## What mistakes should I avoid?

- **Underlining on hover only.** The audit, touch users and keyboard users never see it.
- **Changing the link color to a slightly different blue.** A new color that still measures under 3:1 against the text fails the same way. Measure it, or add the underline.
- **Fixing 3:1 against the text and breaking 4.5:1 against the background.** You trade this audit for a color-contrast failure.
- **Removing underlines sitewide with one rule.** Scope `text-decoration: none` to navigation, buttons and cards instead of the bare `a` selector.
- **Using `outline` as the permanent cue.** It passes, but an outline on every link makes the focus indicator impossible to see.

## Related audits

- [Background and foreground colors do not have sufficient contrast](/audits/color-contrast): the 4.5:1 check between text and its background
- [Links do not have a discernible name](/audits/link-name): links a screen reader cannot announce
- [Links do not have descriptive text](/audits/link-text): "click here" and "learn more" anchors
- [Links are not crawlable](/audits/crawlable-anchors): anchors with no usable `href`

---

Audit your URL at https://lighthouse-md.com.
