Need to calculate reading time for your content? This guide covers everything you need to know about estimating reading time via API, including algorithms, customization options, and implementation examples.
What is Reading Time Estimation?
Reading time estimation calculates how long it takes an average person to read a piece of text. This is commonly displayed on blogs and articles to help readers gauge the commitment required before starting to read.
Example: "5 min read" tells users the article takes about 5 minutes to read.
How Reading Time Calculation Works
Reading time is typically calculated using these factors:
- Word count: Total number of words in the text
- Reading speed: Average adult reads 200-250 words per minute
- Content type: Technical content may require slower reading
- Media: Images add extra viewing time
Using the Reading Time API
TinyFn provides a simple endpoint to estimate reading time:
POST https://api.tinyfn.io/v1/text/reading-time
Headers: X-API-Key: your-api-key
Content-Type: application/json
{
"text": "Your article content here...",
"words_per_minute": 250
}
{
"reading_time_minutes": 5,
"reading_time_seconds": 312,
"word_count": 1300,
"display_time": "5 min read"
}
Parameters
| Parameter | Type | Description |
|---|---|---|
text |
string | The text to analyze (required) |
words_per_minute |
integer | Reading speed in WPM (default: 250) |
image_count |
integer | Number of images to add extra time (default: 0) |
Code Examples
JavaScript / Node.js
const response = await fetch(
'https://api.tinyfn.io/v1/text/reading-time',
{
method: 'POST',
headers: {
'X-API-Key': 'your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
text: 'Your article content here...',
words_per_minute: 250
})
}
);
const result = await response.json();
console.log(result.display_time); // "5 min read"
Python
import requests
response = requests.post(
'https://api.tinyfn.io/v1/text/reading-time',
headers={'X-API-Key': 'your-api-key'},
json={'text': 'Your article content here...', 'words_per_minute': 250}
)
result = response.json()
print(result['display_time']) # "5 min read"
cURL
curl -X POST "https://api.tinyfn.io/v1/text/reading-time" \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{"text": "Your article content here...", "words_per_minute": 250}'
Common Use Cases
- Blog Platforms: Display reading time on article listings
- News Sites: Help readers choose articles based on time
- Learning Platforms: Estimate lesson completion times
- Email Marketing: Predict newsletter reading time
- Content Planning: Ensure articles meet length targets
Best Practices
- Use appropriate WPM: 250 for general, 200 for technical content
- Account for images: Add 12 seconds per image
- Round appropriately: Display "5 min" not "4.7 min"
- Consider minimum: Show "1 min read" for very short content
Try the Reading Time API
Get your free API key and start estimating reading time in seconds.
Get Free API Key