Home›Calculators›Marketing›Text to HTML Ratio Calculator

Text to HTML Ratio Calculator

Marketing

Paste your page's HTML source to see its text to HTML ratio, visible text size, and word count. Runs in your browser, so nothing is uploaded.

Written by · Reviewed by the thecalcu.com team · Last updated October 16, 2026

Open your page, press Ctrl+U (Cmd+Option+U on Mac) to view the source, select all, copy, and paste it here. The calculation runs in your browser and nothing is uploaded.

What is a Text/HTML Ratio?

The Text to HTML Ratio Calculator measures how much of a web page's source code is readable text. You paste the page's HTML, and it compares the length of the visible text with the length of the whole file. A page that is 30% text and 70% markup scores 30%.

SEO audit tools report this number because it's a quick way to spot pages that are mostly code: thin pages, template-heavy pages, or pages carrying a lot of inline scripts and styles. It isn't a Google metric, and Google has said it isn't a ranking factor, so use it to find bloat and not as a target. If you also want the raw size and count of your copy, the Word Count Calculator and the Text Size Calculator cover that side.

How to use this Text/HTML Ratio calculator

  1. Open the page you want to check in your browser.
  2. Press Ctrl+U (Cmd+Option+U on a Mac) to view its source, then select all and copy.
  3. Paste it into the Page HTML source box. The result appears as you paste.
  4. Read the Text to HTML Ratio card first, then compare Visible Text Size with Total HTML Size in characters.
  5. Check the Word Count to see how much actual copy the page holds.
  6. If the ratio looks low, look through the source for inline scripts, large inline styles, and repeated wrapper markup.
  7. Use Load an example to see how the numbers move on a small page, and Clear to start over with another page.
Show formula & methodology ↓Hide formula & methodology ↑

Formula & Methodology

The tool applies one formula:

Text to HTML ratio (%) = (visible text length ÷ total HTML length) × 100

To get the visible text, it removes HTML comments, then everything inside script, style, and noscript elements, then every remaining tag. It decodes a handful of common entities (such as & and  ), collapses runs of whitespace into single spaces, and trims the ends. Lengths are counted in characters, and the word count is the number of space-separated tokens left.

Worked example: the built-in sample page is 521 characters of HTML. After removing the tags, the script, and the stylesheet, 202 characters of text remain, including the page title and two navigation links. The ratio is 202 ÷ 521 × 100 = 38.8%, with 35 words.

Because the tool reads source and doesn't render the page, text hidden by CSS is counted and text added later by JavaScript is not. For script-driven pages, paste the rendered HTML from your browser's developer tools.

Why Use a Text to HTML Ratio Calculator?

Page weight and content density are easy to ignore until a page feels slow or a crawl report flags it. The ratio gives you one number for both. A template that comes in far below your other pages is worth a look, because the cause is usually something you can fix, like stray inline styles, unused widgets, or markup repeated for every card in a grid.

It's also a fast check on a draft. If a post you've just written shows up at a very low ratio, the template around it is carrying more weight than the writing is. You can compare a staging page against production without sharing either one, since the tool never sends your HTML anywhere.

Common Mistakes to Avoid

  • Chasing a target number. Adding filler text to hit 25% makes the page worse for readers and doesn't help search. Fix the markup, not the copy.
  • Comparing unlike pages. A long guide and a product grid have different natural ratios. Compare pages built on the same template.
  • Pasting a partial source. Copying only the body leaves out the head, which changes the total length. Paste the full document.
  • Testing a JavaScript shell. If the page loads its content with scripts, the raw source is mostly empty and the ratio looks terrible. Test the rendered HTML instead.
  • Forgetting the title counts. Text in the title element is included, so very short pages score slightly higher than their body copy alone would suggest.

Quick Reference

Ratio What it usually means
Under 10% Mostly code. Check for inline scripts, styles, or a thin page
10% to 25% Markup-heavy. Normal for app screens and product grids
25% to 70% Typical for article and informational pages
Over 70% Mostly text. Common for plain documents with little styling

For related checks, the Word Count Calculator measures your copy, the Text Size Calculator gives its byte size, and the Organic Traffic Value Calculator puts a dollar figure on the search traffic a page earns.

Frequently Asked Questions

What is a text to HTML ratio?

It's the share of a page's source code that is readable text. Divide the length of the visible text by the total length of the HTML file and multiply by 100. A page with 2,000 characters of copy inside 10,000 characters of markup has a ratio of 20%.

Is text to HTML ratio a Google ranking factor?

Google has said it isn't. The ratio is a rule of thumb that SEO audit tools use to spot pages that are mostly code, which tend to be thin on content or slow to load. Treat it as a diagnostic, not a score to chase.

What is a good text to HTML ratio?

Audit tools commonly flag anything under 10% as low and treat roughly 25% to 70% as healthy. A long article usually lands high, while a web app screen, a product grid, or a page built on heavy page-builder markup can sit well below that and still do fine. Compare pages of the same type with each other.

How do I get my page's HTML source to paste here?

Open the page in your browser and press Ctrl+U (Cmd+Option+U on a Mac) to view the source. Select everything, copy it, and paste it into the box. If your page builds its content with JavaScript, use the browser's developer tools, copy the outer HTML of the html element, and paste that instead.

Does this tool upload my page anywhere?

No. The calculation runs in your browser, so the HTML you paste never leaves your device. That makes it safe to use on staging sites, drafts, and pages behind a login.

What counts as visible text?

The tool removes comments, script blocks, style blocks, and noscript blocks, then strips every remaining tag and collapses the whitespace. What's left is the text between your tags, including headings, paragraphs, link text, and the page title. Text hidden with CSS still counts, because the tool reads the source rather than rendering it.

Why is my ratio low even though the page has plenty of content?

Inline CSS, inline SVG, large data attributes, and deeply nested wrapper elements all add characters without adding words. Page builders and some themes are the usual cause. Moving styles into a cached stylesheet and trimming unused markup raises the ratio and often speeds up the page too.

Will raising the ratio improve my rankings?

Not by itself. Padding a page with filler text to move the number can hurt readers and doesn't help search. Improve the ratio as a side effect of cleaning up bloated markup, and judge content on whether it answers the search.

How is this different from a word count?

Word count tells you how much copy you have. The ratio tells you how much of the file that copy occupies. The tool shows both, so you can see a page with 800 words in 400 KB of markup differently from one with 800 words in 40 KB.

Can I use it on a whole site?

It checks one page at a time, because you paste one document's source. For a site audit, run your key templates (home page, a post, a product page) and compare the results. Pages from the same template usually give similar ratios.

Does the ratio change between desktop and mobile?

It can, if your site serves different HTML to different devices. Copy the source from the version you want to test. Most responsive sites send the same HTML to both, so the number will match.
Also known as
text html ratio checkertext to code ratio calculatorSEO text ratio tooltext/html ratio checkercontent to code ratiowebpage text ratio analyzer