<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-to-calculate-reading-time-like-medium-f1jztvvpr" -->

---
title: How to calculate reading time, like Medium | daily.dev
description: A beginner-friendly walkthrough explaining how to build a JavaScript function that estimates reading time for blog posts, similar to Medium's feature. The...
canonical: https://daily.dev/posts/how-to-calculate-reading-time-like-medium-f1jztvvpr
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How to calculate reading time, like Medium | daily.dev
og:description: A beginner-friendly walkthrough explaining how to build a JavaScript function that estimates reading time for blog posts, similar to Medium's feature. The...
og:url: https://daily.dev/posts/how-to-calculate-reading-time-like-medium-f1jztvvpr
og:image: https://api.daily.dev/og/posts/F1jZTVvPr.png
og:image:alt: How to calculate reading time, like Medium
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How to calculate reading time, like Medium

**[Craig Abbott](https://daily.dev/sources/craigabbott)** · 6 min read · 0 upvotes · 0 comments

## Summary

A beginner-friendly walkthrough explaining how to build a JavaScript function that estimates reading time for blog posts, similar to Medium's feature. The function splits text into words using a regex, divides by an assumed 200 words-per-minute reading speed, and rounds up using Math.ceil(). Each line of the 7-line function is explained step by step, including how regex whitespace matching and array splitting work, so it can be reverse-engineered in other languages.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.craigabbott.co.uk/blog/2016/how-to-calculate-reading-time-like-medium>

## Questions this post answers

### How do I calculate estimated reading time for a blog post in JavaScript?

Split the text into words using text.split(/\s/g).length to count words, divide by an assumed reading speed of 200 words per minute, then round up with Math.ceil() so the estimate errs on the side of more time rather than less. This mirrors the approach used to display reading times similar to Medium's feature, using a 7-line function.

_daily.dev surfaces practical JavaScript snippets like this for developers building blog features._

### What words-per-minute value should I use to estimate reading time?

200 words per minute is a reasonable average reading speed estimate, based on general reading speed data. This value is deliberately conservative compared to Medium's own reading time calculations, which assume readers move faster, likely to avoid discouraging engagement on their platform.

_Developers weighing UX tradeoffs like this compare notes and approaches on daily.dev._

## Similar posts on daily.dev

- [There are a lot of ways to break up long tasks in JavaScript. – Frontend Masters Blog](https://daily.dev/posts/there-are-a-lot-of-ways-to-break-up-long-tasks-in-javascript-frontend-masters-blog-i7wklqpek) · Frontend Masters · 0 upvotes · 0 comments
- [Word counter that ignores Markdown](https://daily.dev/posts/word-counter-that-ignores-markdown-lemgobopa) · Planet Python · 1 upvotes · 0 comments
- [7 Readability Features for Your Next Machine Learning Model](https://daily.dev/posts/7-readability-features-for-your-next-machine-learning-model-yscqip6ci) · Machine Learning Mastery · 1 upvotes · 0 comments
- [Little useless-useful R functions – Typing speed benchmark](https://daily.dev/posts/little-useless-useful-r-functions-typing-speed-benchmark-fedq1es7q) · R-bloggers · 0 upvotes · 0 comments
- [Pretext.js Bypasses DOM Layout Reflow, Enabling Advanced UX Patterns at 120 FPS](https://daily.dev/posts/pretext-js-bypasses-dom-layout-reflow-enabling-advanced-ux-patterns-at-120-fps-b1lmzt2mp) · InfoQ · 13 upvotes · 0 comments

---

Tags: [#javascript](https://daily.dev/tags/javascript)

[View this post on daily.dev](https://daily.dev/posts/how-to-calculate-reading-time-like-medium-f1jztvvpr)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How to calculate reading time, like Medium","url":"https://daily.dev/posts/how-to-calculate-reading-time-like-medium-f1jztvvpr","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-to-calculate-reading-time-like-medium-f1jztvvpr"},"datePublished":"2026-09-20T07:44:39.665Z","dateModified":"2026-09-20T07:49:27.714Z","description":"A beginner-friendly walkthrough explaining how to build a JavaScript function that estimates reading time for blog posts, similar to Medium's feature. The...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/a0ffc407e6f6c1b75eadc5a3e5dc0325?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/a0ffc407e6f6c1b75eadc5a3e5dc0325?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Craig Abbott","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Craig Abbott","logo":"https://media.daily.dev/image/upload/s--7L_KxzEH--/f_auto,q_auto/v1789890198/logos/craigabbott?_a=BAMAMicg0","url":"https://daily.dev/sources/craigabbott"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-to-calculate-reading-time-like-medium-f1jztvvpr","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"javascript","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Craig Abbott","item":"https://daily.dev/sources/craigabbott"},{"@type":"ListItem","position":3,"name":"How to calculate reading time, like Medium"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-to-calculate-reading-time-like-medium-f1jztvvpr#faq","mainEntity":[{"@type":"Question","name":"How do I calculate estimated reading time for a blog post in JavaScript?","acceptedAnswer":{"@type":"Answer","text":"Split the text into words using text.split(/\\s/g).length to count words, divide by an assumed reading speed of 200 words per minute, then round up with Math.ceil() so the estimate errs on the side of more time rather than less. This mirrors the approach used to display reading times similar to Medium's feature, using a 7-line function. daily.dev surfaces practical JavaScript snippets like this for developers building blog features."}},{"@type":"Question","name":"What words-per-minute value should I use to estimate reading time?","acceptedAnswer":{"@type":"Answer","text":"200 words per minute is a reasonable average reading speed estimate, based on general reading speed data. This value is deliberately conservative compared to Medium's own reading time calculations, which assume readers move faster, likely to avoid discouraging engagement on their platform. Developers weighing UX tradeoffs like this compare notes and approaches on daily.dev."}}]}
```

