Free Internal Link Checker with HTTP Response Status Codes

Easily analyze all internal links on any webpage using this free JavaScript-based internal link checker tool. This Chrome console script scans links pointing to the same domain and verifies their exact HTTP response status codes, helping you detect broken links, redirects, and server errors instantly.

This tool is ideal for SEO audits, technical website analysis, and debugging internal linking issues without relying on third-party crawlers.

Script for Outgoing Internal Links from a Page

How to Use This Tool

  1. Open the website you want to test in Google Chrome.
  2. Press F12 (or Cmd + Option + I on Mac) or Ctrl + Shift + I (or Right Click → Inspect) and switch to the Console tab.
  3. Paste this code and press Enter:

(async () => {
    console.log("%c🔍 Scanning Internal Links...", "color: #4f46e5; font-weight: bold; font-size: 14px;");
    
    const currentHost = window.location.host;
    const currentProtocol = window.location.protocol;
    
    // 1. Gather all anchor tags on the page
    const allLinks = Array.from(document.querySelectorAll('a[href]'));
    const internalLinks = [];
    const seenUrls = new Set();

    allLinks.forEach(link => {
        try {
            // Resolve relative URLs to absolute URLs automatically
            const url = new URL(link.href, window.location.origin);
            
            // Filter: Must match current domain, must be http/https, ignore page hashes/anchors (#)
            if (url.host === currentHost && 
                (url.protocol === 'http:' || url.protocol === 'https:') && 
                !seenUrls.has(url.origin + url.pathname + url.search)) {
                
                const cleanUrl = url.origin + url.pathname + url.search;
                seenUrls.add(cleanUrl);
                
                internalLinks.push({
                    anchorText: link.textContent.trim() || '[No Anchor Text]',
                    url: cleanUrl
                });
            }
        } catch (e) {
            // Skip invalid or unparseable URLs
        }
    });

    if (internalLinks.length === 0) {
        console.log("✅ No internal links found on this page.");
        return;
    }

    console.log(`📊 Found ${internalLinks.length} unique internal URLs. Pinging URLs for status codes...`);

    // 2. Fetch status codes asynchronously
    const results = [];
    
    for (const item of internalLinks) {
        try {
            // Using standard GET or HEAD to check internal paths
            const response = await fetch(item.url, { method: 'GET' });
            
            results.push({
                "Anchor Text": item.anchorText,
                "Internal URL": item.url,
                "Status": response.status,
                "Status Text": response.statusText || (response.status === 200 ? "OK" : "")
            });
        } catch (error) {
            results.push({
                "Anchor Text": item.anchorText,
                "Internal URL": item.url,
                "Status": "FAILED / BLOCKED",
                "Status Text": "Network Error"
            });
        }
    }

    // 3. Separate clean links from broken/redirected links for easier analysis
    console.log("%c📋 All Internal Links Results:", "color: #10b981; font-weight: bold; font-size: 14px;");
    console.table(results);

    const brokenLinks = results.filter(r => r.Status === 404);
    if (brokenLinks.length > 0) {
        console.log("%c🚨 CRITICAL: Found 404 Broken Internal Links!", "color: #ef4444; font-weight: bold; font-size: 14px;");
        console.table(brokenLinks);
    } else {
        console.log("%c🎉 Clean Sweep! No 404 internal links detected on this page view.", "color: #10b981; font-weight: bold;");
    }
})();
    

What This Script Does

Extracts all internal links (same domain). Removes duplicate URLs. Sends HTTP HEAD requests. Returns actual status codes (200, 301, 404, 500, etc.). Displays results in a clean console table.

Script for Incoming Internal Links to a Page

This script helps you identify all internal links pointing to a specific page within your website. By analyzing incoming links, you can better understand how your pages are interconnected and how link equity flows across your site.

Specially useful for SEO optimization, allowing you to strengthen important pages, fix orphan pages, and improve overall site structure. Simply run the script to extract a list of URLs that link to the target page, along with anchor text and link sources (if configured).


async function findSourcePagesAndAnchorTypes() {

  const currentOrigin = window.location.origin;

  const currentPath = window.location.pathname;

  const currentFullUrl = currentOrigin + currentPath;

  const pageLinks = Array.from(document.querySelectorAll('a[href]'))

    .map(a => {

      try {

        const u = new URL(a.href, currentOrigin);

        return u.origin === currentOrigin ? u.origin + u.pathname : null;

      } catch { return null; }

    })

    .filter(url => url && url !== currentFullUrl);

  const pagesToScan = [...new Set(pageLinks)];

  console.log(`Scanning ${pagesToScan.length} pages on ${currentOrigin} for links pointing to "${currentPath}"...\n---`);

  const results = [];

  for (const pageUrl of pagesToScan) {

    try {

      const response = await fetch(pageUrl);

      const text = await response.text();

      const doc = new DOMParser().parseFromString(text, 'text/html');

      const matchingLinks = Array.from(doc.querySelectorAll('a[href]')).filter(a => {

        try {

          const u = new URL(a.href, currentOrigin);

          return u.origin === currentOrigin && (u.pathname === currentPath || u.pathname === currentPath + '.html');

        } catch { return false; }

      });

      matchingLinks.forEach(a => {

        let sourceType = 'Text';

        let sourceContent = a.innerText.trim().replace(/\s+/g, ' ');

        const img = a.querySelector('img');

        const svg = a.querySelector('svg');

        if (img) {

          sourceType = 'Image';

          sourceContent = img.alt ? `Alt: "${img.alt}"` : `Image Src: ${img.src.split('/').pop()} (No Alt)`;

        } else if (svg) {

          sourceType = 'SVG Icon';

          if (!sourceContent) sourceContent = '[SVG Graphic / Icon]';

        } else if (!sourceContent) {

          sourceType = 'Empty / Hidden';

          sourceContent = '[No Text Detected]';

        }

        results.push({

          'Source Page (URL)': pageUrl,

          'Source Type': sourceType,

          'Anchor Text / Source': sourceContent,

          'Exact Href Used': a.getAttribute('href')

        });

      });

    } catch (err) {

      console.warn(`Could not fetch ${pageUrl}`);

    }

  }

  console.log(`Scan Complete! Found ${results.length} incoming links:\n`);

  console.table(results);

}

findSourcePagesAndAnchorTypes();

    

    

Why Internal Link Checking is Important

Internal links are critical for website structure, SEO performance, and user navigation. Broken internal links can negatively affect search engine crawling and reduce user trust.

By auditing internal links, you can:

  • Identify broken pages (404 errors)
  • Detect redirect chains (301/302)
  • Improve crawl efficiency
  • Strengthen site architecture
  • Enhance user experience