Skip to content

Set expectations for a longer article

Reading Time Badge Generator

Estimate reading time from an article's words, choose your reading-speed assumption, and display the result where it belongs.

Free preview and code export. No account required.

Choose the article scope and estimate.

Use article or one class or ID matching exactly one content area that contains the badge. Inspect your published markup and choose the article body, not a single text block. Template structures vary.

The default 200 words per minute is an editable assumption, not a measured personal reading speed. The estimate divides words by your chosen rate and rounds up to a whole minute. Empty content gets no estimate.

Include {minutes} exactly once. Use wording such as “About” or “Estimated” to make the uncertainty clear.

Use a six-digit hex color. Filled-badge text switches to black or white for contrast. Plain text and icon styles inherit the surrounding text color.

Estimate your article text

Paste plain article text, up to 50,000 characters. The text stays in this page's memory and is excluded from the code export. Settings and preview text are not saved to an account.

0 words counted. Paste article text to see an estimate.

The counter uses English word segmentation. It counts words and numbers, ignores punctuation alone, and can distinguish words without relying only on spaces. The speed assumption is intended for English prose. Other languages, technical material, images, videos, and code need their own judgment.

The installed badge reads visible text across the selected article area. It excludes H1 headings, site chrome, forms, supported callouts, code snippets, hidden content, and other articles. Preview text can differ from that published scope, so inspect the actual count after installation.

Copy the free code

Place the complete export in one HTML Code block at the desired badge location inside the article. The badge stays there and does not depend on a theme-specific title selector. No preview text is included.

View generated code
<!-- Reading Time: a word-count estimate, not observed reader behavior. -->
<style>[data-sqt-reading]{display:inline-flex;align-items:center;gap:8px;max-width:100%;margin:8px 0 16px;padding:8px 12px;border-radius:4px;background:var(--sqt-read-bg);color:var(--sqt-read-ink);font-family:inherit;font-size:var(--sqt-read-size);line-height:1.5;overflow-wrap:anywhere}[data-sqt-reading][hidden]{display:none}[data-sqt-reading][data-style="plain"],[data-sqt-reading][data-style="icon"]{background:transparent;color:inherit;padding:0}[data-sqt-reading] svg{width:1em;height:1em;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:1.5}[data-sqt-reading]:not([data-style="icon"]) svg{display:none}[data-sqt-reading-label]{min-width:0}</style>
<span data-sqt-reading hidden data-selector="article" data-wpm="200" data-label="About {minutes} min read" data-style="badge" data-words="false" style="--sqt-read-bg:#eef2e8;--sqt-read-ink:#000000;--sqt-read-size:14px;"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="9"/><path d="M12 6v6l4 2"/></svg><span data-sqt-reading-label></span></span>
<script>(function(){
  'use strict';
  if(window.__sqtReadingV1){window.__sqtReadingV1.refresh();return;}
  var frame=0,paused=false,stopped=false,observer=new MutationObserver(changed);
  var segmenter=typeof Intl.Segmenter==='function'?new Intl.Segmenter('en',{granularity:'word'}):null;
  function visible(element){for(var node=element;node;node=node.parentElement){var css=getComputedStyle(node);if(node.hidden||node.getAttribute('aria-hidden')==='true'||css.display==='none'||css.visibility==='hidden'||css.visibility==='collapse'||(node.tagName==='DETAILS'&&!node.open))return false;}return true;}
  function collect(node,article){
    if(node.nodeType===3)return node.nodeValue||'';
    if(node.nodeType!==1)return '';
    if(node.matches('script,style,template,noscript,header,footer,nav,aside,form,button,input,select,textarea,svg,dialog,pre,code,h1,[data-sqt-reading],[data-sqt-toc],[data-sqt-newsletter]')||node.closest('article')!==article||!visible(node))return '';
    if(node.tagName==='BR')return '\n';
    var text='';for(var child=node.firstChild;child;child=child.nextSibling)text+=collect(child,article);
    var display=getComputedStyle(node).display;return /^(block|flow-root|flex|grid|table|list-item)/.test(display)?'\n'+text+'\n':text;
  }
  function update(root){
    var selector=root.getAttribute('data-selector'),wpm=Number(root.getAttribute('data-wpm')),label=root.getAttribute('data-label')||'',output=root.querySelector('[data-sqt-reading-label]');
    if(!segmenter||!output||!selector||!Number.isInteger(wpm)||wpm<100||wpm>600||label.split('{minutes}').length!==2){root.hidden=true;return;}
    var areas;try{areas=document.querySelectorAll(selector);}catch(_){root.hidden=true;return;}
    if(areas.length!==1||!areas[0].contains(root)||areas[0]===root||!visible(root.parentElement)){root.hidden=true;return;}
    var area=areas[0],article=root.closest('article'),text='';
    // A selected wrapper may contain several stories; count only this badge's article.
    if(area.closest('article')===article)text=collect(area,article);
    else if(article&&area.contains(article))text=collect(article,article);
    var words=0;for(var part of segmenter.segment(text))if(part.isWordLike)words++;
    if(!words){root.hidden=true;return;}
    var value=label.replace('{minutes}',String(Math.ceil(words/wpm)));
    if(root.getAttribute('data-words')==='true')value+=' ('+words+' '+(words===1?'word':'words')+')';
    if(output.textContent!==value)output.textContent=value;
    if(root.hidden)root.hidden=false;
  }
  function refresh(){if(!paused&&!stopped&&!frame)frame=requestAnimationFrame(function(){frame=0;document.querySelectorAll('[data-sqt-reading]').forEach(update);});}
  function changed(records){if(records.some(function(record){var node=record.target.nodeType===1?record.target:record.target.parentElement;return !node||!node.closest('[data-sqt-reading]');}))refresh();}
  function observe(){observer.observe(document.body,{subtree:true,childList:true,characterData:true,attributes:true,attributeFilter:['id','class','style','hidden','aria-hidden','open']});}
  function pause(event){if(event.persisted){paused=true;observer.disconnect();if(frame)cancelAnimationFrame(frame);frame=0;}else cleanup();}
  function resume(event){if(event.persisted&&!stopped){paused=false;observe();refresh();}}
  function cleanup(){stopped=true;observer.disconnect();if(frame)cancelAnimationFrame(frame);window.removeEventListener('pagehide',pause);window.removeEventListener('pageshow',resume);window.removeEventListener('resize',refresh);document.removeEventListener('DOMContentLoaded',start);delete window.__sqtReadingV1;}
  function start(){if(stopped||!document.body)return;observe();refresh();}
  window.__sqtReadingV1={refresh:refresh};window.addEventListener('pagehide',pause);window.addEventListener('pageshow',resume);window.addEventListener('resize',refresh);
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',start,{once:true});else start();
})();</script>

Inspect the estimate on the published article.

This automatic badge requires JavaScript in Code blocks, currently available on Core, Plus, and Advanced. Check legacy-plan support. Read Squarespace's Code block requirements.

  1. Choose the full article area and confirm its selector matches exactly one element containing the badge. Select the content body to avoid unrelated metadata.
  2. Paste the entire export in an HTML Code block, turn Display Source off, and replace any older Reading Time snippets or footer injection.
  3. Inspect the published page while signed out. Temporarily enable the word count and compare a short known passage, then inspect the complete article.
  4. Check narrow and wide screens, content changes, and Back/Forward navigation. Multiple exports keep separate settings and do not count one another.

The badge updates when content or visibility changes. It stays hidden when the target is missing, ambiguous, or empty, and when JavaScript or browser word segmentation is unavailable. The article remains readable.

Installing this export does not update previously pasted snippets or every blog post automatically. Reading-time estimates are separate from observed engagement, leads, and sales. Read the complete reading-time guide.