How to Estimate the Reading Time of an Article or Website Text

2 min read
A reading-time estimate is a useful tool that helps visitors understand how long an article will take to read. If you want to add this feature to your website and need a developer to implement it, we can help. A PHP implementation example is included at the end.

Use the following formula to calculate the time required to read an article:

An adult's average reading speed is 1,500 characters per minute. To estimate the reading time, divide the total number of characters in the text by 1,500. This gives an approximate number of minutes.

Each image adds another 0.2 minutes. After completing the calculation, round up to the next whole minute if the fractional part exceeds 0.3. This helps avoid understating the estimate for people who read more slowly than average.

For example, suppose an article contains 4,315 characters and two images:
4315/1500=2,87
2.87 + 0.2 × 2 images = 3.27

Round this to a reading time of 3 minutes.

With 4,350 characters, the estimate would be 4 minutes, rounding 3.3 up to 4.

I do not recommend calculating reading time from analytics data, as this would complicate a simple feature. Its purpose is to give readers a rough idea of how long the material will take to read. High precision is unnecessary.
Readers may also stop before finishing, take a break or spend a long time looking at images. Accounting for these factors in the calculation is impractical.

To calculate an article's reading time in PHP, you can use the following approach:
  • Define a calculateReadingTime function that accepts the article text and, optionally, a reading speed in words per minute, with a default of 1,500 words per minute.
  • Inside the function, split the text into words using str_word_count or count(preg_split('/\s+/', strip_tags($text))) to count all the words.
  • Estimate the reading time by dividing the total word count by the reading speed.
  • Use echo to display the result.
Usage example:


function calculateReadingTime($text, $wordsPerMinute = 1500) {
    $words = str_word_count(strip_tags($text));
    $readingTime = ceil($words / $wordsPerMinute);
    return $readingTime;
}

$articleText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed commodo nisl eu elit tincidunt, sed lobortis odio commodo. Sed consectetur, elit nec viverra pellentesque, mi felis cursus justo, at porttitor urna diam id mauris. Fusce viverra nisl ut ante dapibus eleifend.";

$readingTime = calculateReadingTime($articleText);
echo "Время чтения статьи: " . $readingTime . " минут(ы)";

This code estimates the article's reading time from its word count and the specified reading speed.
Back to blog