Home / SEO and Site Tools / Page SEO Audit

Page SEO Audit in JavaScript, Free with Live Demo

Free on-page SEO audit in plain JavaScript. Paste a page's HTML to check the title, description, headings, image alt text, links, canonical, Open Graph, schema and more, with a score and fixes.

Open live demoDownload HTML fileView code on GitHub
Page SEO Audit JavaScript project: an on-page SEO checker that scores a page and lists what to fix

Runs on: DOMParser. Works in all modern browsers.

What is the Page SEO Audit?

An on-page SEO checker. Paste any page source, or use the sample bakery page, and get a score out of 100 with passed checks, things to improve and failures.

It checks the title, description, headings, image alt text and sizes, language, mobile viewport, canonical, social tags, structured data, word count, links and noindex, with a short fix for each problem.

Good for

  • Before publishing a page
  • Reviewing client sites
  • Checking pages that do not rank
  • Teaching on-page SEO

What this project does

How it works

  1. Parse without loadingDOMParser turns the pasted HTML into a document you can query, without running its scripts or loading its images.
  2. Sixteen quick rulesTitle and description length, one h1 and heading order, alt text and image sizes, language, viewport, canonical, Open Graph, schema, word count, links and noindex.
  3. Score and sortPasses count fully, warnings half. Failed checks come first, each with a short reason and, where useful, the code to add.

The key JavaScript

This is the heart of the project. The full file has the rest, including the screen layout and error handling.

const doc = new DOMParser().parseFromString(html, "text/html");
const checks = [];
const title = doc.querySelector("title")?.textContent.trim() || "";
checks.push(title.length >= 30 && title.length <= 60 ? "pass" : "warn");
checks.push(doc.querySelectorAll("h1").length === 1 ? "pass" : "fail");
checks.push(doc.querySelectorAll("img:not([alt])").length ? "fail" : "pass");
checks.push(doc.querySelector('link[rel="canonical"]') ? "pass" : "warn");
const score = checks.reduce((a, c) => a + (c === "pass" ? 1 : c === "warn" ? 0.5 : 0), 0) / checks.length * 100;

How to use it

  1. Click Download HTML file above.
  2. Open the file in a code editor, like VS Code.
  3. Run it from a local server with npx serve . so the camera, microphone and AI features are allowed.
  4. Change the text and colors, then upload it to GitHub Pages, Netlify or your own site. It is one file with no build step.

Questions people ask

Can it check a live URL?

Browsers block reading other sites directly. Open the page, view its source, and paste it here. A server version could fetch URLs for you.

Does a score of 100 mean I will rank first?

No. These checks cover the basics on the page. Content quality, links and speed matter a lot too.

Why is word count a warning, not a failure?

Some pages, like contact pages, are short on purpose. Thin content only matters on pages you want to rank.

More SEO and Site Tools projects