How to Fix Empty Anchor Links and Icon-Only Links

An empty anchor link is an <a> element with no readable text: a social icon, a cart or search icon, a logo image with no alt text, or a leftover <a href="#"></a>. By the end of this guide you will have found every empty link on the flagged pages, given each one an accessible name, removed the useless ones, and confirmed the fix with a re-scan.

By Updated ⏱ 20 minutes🎯 Beginner● Low impactOn-Page
Illustration: Empty anchor links fix guide
ON-PAGE · FIX GUIDE Empty anchor links IMPACTEFFORT TIME20 minutes LEVELBeginner

Why it matters

Search engines use anchor text to understand where a link points, so an empty link passes no topical signal to its target page. 2 (Name, Role, Value) and can create legal accessibility exposure. AI crawlers that build summaries from page text also ignore links with no text.

The SEO impact is small, but the fix usually takes a few template edits, and those edits apply to every page at once.

✕Before<ahref="https://instagram.com/exampleco"><svgclass="icon-instagram">…</svg></a> is✓After<ahref="https://instagram.com/exampleco"aria-label="Example Co on

What you need

Access to your theme, template or page builder editor
A desktop browser with DevTools (Chrome, Edge or Firefox)
The list of flagged URLs from your audit report
Optional: a screen reader such as NVDA (Windows) or VoiceOver (macOS) for spot checks

Step-by-step fix

1

List every empty link on a flagged page

Open one of the flagged URLs, press F12 to open DevTools, go to the Console tab and paste the snippet below. It outlines each link with no text, no aria-label, no aria-labelledby, no title and no image alt text in red, and prints its HTML so you can see exactly what is wrong. Run it on two or three flagged pages of different types, such as the homepage, a product page and a blog post.

javascript
[...document.querySelectorAll('a[href]')].filter(a => {
  const text = (a.textContent || '').trim();
  const label = (a.getAttribute('aria-label') || a.getAttribute('aria-labelledby') || a.getAttribute('title') || '').trim();
  const imgAlt = [...a.querySelectorAll('img')].some(i => (i.getAttribute('alt') || '').trim());
  return !text && !label && !imgAlt;
}).forEach(a => { a.style.outline = '3px solid red'; console.log(a.outerHTML); });
Pro tip: If the console prints nothing, the empty link may be inside a menu that loads on click or scroll. Open the mobile menu and any mega-menus, then run the snippet again.
2

Group the results by template

Empty links almost always come from shared components, not individual pages. Sort what you found into these groups:

  • Header icons: search, account, cart, hamburger menu
  • Footer social icons
  • Logo link with an image that has an empty alt
  • Card overlay links: an empty <a> stretched over a product or blog card
  • Placeholder links: <a href="#"></a> left behind by a theme or plugin

Fixing one header or footer file usually clears most of the flagged pages at once.

Pro tip: Copy a CSS class from each printed element, such as .header__icon--cart, and search your theme files for it. That finds the source file quickly.
3

Name icon-only links with hidden text or aria-label

Give each icon link a name that describes its destination or action, such as "Cart" or "Example Co on LinkedIn". Visually hidden text is the most robust option because it is real text that crawlers and translation tools also read. aria-label also works well.

Add aria-hidden="true" and focusable="false" to decorative SVGs so screen readers do not read the SVG markup.

html
<style>
.visually-hidden{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
</style>

<!-- Option A: visually hidden text -->
<a href="/cart" class="header-icon">
  <svg aria-hidden="true" focusable="false"><use href="#icon-cart"></use></svg>
  <span class="visually-hidden">Cart</span>
</a>

<!-- Option B: aria-label -->
<a href="https://www.linkedin.com/company/exampleco" aria-label="Example Co on LinkedIn">
  <svg aria-hidden="true" focusable="false"><use href="#icon-linkedin"></use></svg>
</a>
Pro tip: Do not use display:none or visibility:hidden for the hidden text. Both remove the text from the accessibility tree, so the link stays empty.
4

Add alt text to images that are the only link content

When an image is the only thing inside a link, its alt text becomes the link text. Write alt text that describes where the link goes, not what the image looks like. png".

Keep alt="" only for images that sit next to visible link text.

html
<a href="/">
  <img src="/img/example-co-logo.svg" alt="Example Co home" width="160" height="40">
</a>
Pro tip: Check that background-image logos (CSS) have a fallback name. CSS images have no alt attribute, so the link needs hidden text or an aria-label.
5

Remove or rebuild truly empty anchors

Delete placeholder links such as <a href="#"></a> and empty social links left over from demo content. For stretched card links, put the link on the card heading instead of a separate empty <a>. Then use a CSS pseudo-element to make the whole card clickable.

If an empty anchor only exists as a jump target, such as <a name="top"></a>, delete it and put an id on the nearby element.

html
<!-- Before -->
<div class="card">
  <a href="/blog/winter-guide" class="card-overlay"></a>
  <h3>Winter care guide</h3>
</div>

<!-- After -->
<div class="card" style="position:relative">
  <h3><a href="/blog/winter-guide" class="card-link">Winter care guide</a></h3>
</div>
<style>.card-link::after{content:"";position:absolute;inset:0}</style>
Pro tip: Avoid adding the same descriptive label to an overlay link and a heading link on one card. Screen reader users would hear the destination twice.
6

Verify on live pages and re-run the audit

Clear your site cache, CDN cache and any page builder cache. Then reload a flagged page and run the console snippet from step 1 again. It should print nothing.

Next, open DevTools > Elements, select a fixed link and check that the Accessibility pane shows a non-empty Name. Finally, re-run the site audit so every page is re-crawled, and confirm the count of affected pages has dropped to zero.

Pro tip: Lighthouse's Accessibility category includes a "Links do not have a discernible name" audit. It is a quick second opinion for any single page.

Platform-specific notes

WordPress

In the block editor, select the **Social Icons** block, click each icon and fill the **Link label** field in the block toolbar or sidebar. For a block theme, edit the header and footer under **Appearance > Editor > Patterns > Template Parts**. For a classic theme, add aria-label or a screen-reader-text span in header.php or footer.php through a child theme; most themes already include the .screen-reader-text class. Purge any caching plugin (WP Rocket, LiteSpeed Cache) afterwards.

Shopify

Go to **Online Store > Themes > … > Edit code** and check sections/header.liquid, sections/footer.liquid and snippets such as social-icons.liquid or icon-*.liquid. Dawn-based themes include a .visually-hidden class. Wrap a translatable label in it, for example <span class="visually-hidden">{{ 'general.cart.title' | t }}</span>. Duplicate the theme before editing so you can roll back.

Wix / Wix Studio

For linked images, select the image, click **Settings** and fill **What's in the image? (alt text)**. For icon buttons, open **Accessibility** (Studio) or **Settings > Accessibility**, then set an **ARIA label**. Under Settings > Social Bar, each linked icon needs alt text that names the network. Wix renders the HTML, so you cannot edit the markup directly.

Webflow

Select the Link Block, open **Element Settings (D) > Custom Attributes** and add name aria-label with a value such as "Example Co on Instagram". For images inside links, set the Alt Text in the image settings, not "Decorative". If the link lives in a Symbol or Component, fix it once there, then publish to all domains.

Next.js / React

Icon components inside <Link> (lucide-react, react-icons, Heroicons) render SVG only. Pass aria-label to <Link> and aria-hidden to the icon. Example: <Link href="/cart" aria-label="Cart"><ShoppingCart aria-hidden="true" /></Link>. If labels are added client-side after hydration, crawlers may miss them, so make sure they are in the server-rendered HTML. Add eslint-plugin-jsx-a11y with the anchor-has-content rule to block regressions in CI.

Check that it worked

✅ How to verify

  • Run the DevTools console snippet from step 1 on several flagged URLs; it should print no elements.
  • In DevTools > Elements > Accessibility pane, each fixed link shows a computed Name that matches its destination.
  • Run Lighthouse (DevTools > Lighthouse > Accessibility) and confirm "Links do not have a discernible name" no longer appears.
  • Re-run the site audit and confirm the Empty anchor links check reports zero affected pages.

⚠️ Common mistakes

  • Hiding the label with display:none or visibility:hidden, which removes it from the accessibility tree, so the link stays empty.
  • Adding aria-label to the SVG instead of the <a>, or leaving the SVG un-hidden so screen readers read meaningless markup.
  • Writing generic labels like "icon", "link" or "click here" that technically pass but describe nothing.
  • Fixing only the homepage in the page editor when the empty link lives in a shared header or footer template that every page uses.

Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.

Check my site free

FAQ

Is an empty link bad for SEO?

Mildly. Google can still follow the link, but it gets no anchor text to understand the target page, and logo links fall back to alt text only. The bigger issue is accessibility, since screen reader users hear only "link" with no destination.

Should I use aria-label or visually hidden text?

Both give the link an accessible name. Visually hidden text is slightly more robust because browser translation and some crawlers read it as normal text. aria-label is quicker to add in page builders that only allow attributes.

Does a title attribute fix an empty link?

It does supply an accessible name as a last resort, so many checkers accept it. However, it shows only on mouse hover and is read inconsistently by screen readers. Use aria-label or hidden text instead.

Why are pages still flagged after I fixed the link?

Usually a cache is serving the old HTML, the same empty link exists in another component (such as the mobile menu or a footer duplicate), or the label is added by JavaScript after the page loads. Clear all caches and check the raw page source, not only the live DOM.