Text to HTML Ratio Calculator
MarketingPaste 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 Yashaswini Shivaprakash · 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
- Open the page you want to check in your browser.
- Press Ctrl+U (Cmd+Option+U on a Mac) to view its source, then select all and copy.
- Paste it into the Page HTML source box. The result appears as you paste.
- Read the Text to HTML Ratio card first, then compare Visible Text Size with Total HTML Size in characters.
- Check the Word Count to see how much actual copy the page holds.
- If the ratio looks low, look through the source for inline scripts, large inline styles, and repeated wrapper markup.
- 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.