Skip to content

Text to Code Ratio Checker

Measure the share of visible text versus HTML code on a page.

Processed locally in your browser.

How do you check a page's text to code ratio?

Text-to-code ratio = visible text length ÷ total HTML length × 100, where visible text is what remains after scripts, styles, comments and tags are removed and whitespace is collapsed. For <p>Hi there</p> (15 characters), the text "Hi there" (8 characters) gives 8 ÷ 15 = 53.33%. A higher ratio, roughly 25–70%, signals a content-rich page.

Understanding your result

There is no official search-engine threshold, but a higher ratio (roughly 25–70%) signals a content-rich page rather than one dominated by code. A very low ratio can be a hint to add meaningful content or trim heavy inline scripts and styles.

Formula and method

Text-to-code ratio = visible text length ÷ total HTML length × 100. Visible text is what remains after scripts, styles, comments and tags are removed and whitespace is collapsed.

Worked example

For the markup <p>Hi there</p> (15 characters) the visible text is "Hi there" (8 characters), so the ratio is 8 ÷ 15 = 53.33%.

How to use this tool

  1. Open the page and view its HTML source.
  2. Copy and paste the source into the box.
  3. Read the text-to-code ratio and counts.

Common mistakes to avoid

  • Treating the ratio as a direct ranking factor — it is a guide, not a rule.
  • Pasting rendered text instead of the raw HTML source.
  • Chasing a high ratio by stripping necessary markup.

About the Text to Code Ratio Checker

The Text to Code Ratio Checker measures how much of a page is visible text compared with HTML markup. It strips scripts, styles, comments and tags, then compares the remaining text with the full source length.

Who should use this tool

SEO specialists, web developers and content teams auditing pages for content depth.

Benefits

  • Instant text-to-code percentage with character counts.
  • Removes scripts, styles, comments and tags accurately.
  • Plain-language assessment of the ratio.
  • Private — your HTML never leaves the browser.

Practical use cases

  • Auditing a thin page that is heavy on markup.
  • Comparing your page against a competitor page.
  • Spotting bloated, code-heavy templates.

Explore all SEO and Website Tools tools

Frequently asked questions

What is a good text to code ratio?

There is no fixed rule, but a ratio of roughly 25–70% is often cited as healthy. Focus on useful content rather than a target number.

Does a higher ratio improve rankings?

Not directly. Search engines rank content quality and relevance; the ratio is just a diagnostic that can flag overly code-heavy pages.

What counts as code here?

Everything that is not visible text: HTML tags, inline scripts and styles, comments and the markup characters around your content.

Share this tool

Free to use — copy the link, share it anywhere, or add the tool to your own website.

Embed this tool on your site (free)

Copy this code and paste it into any web page — it stays free and always up to date: