Typing Speed Test: how it works and how to build one
Test your typing speed in WPM with accuracy. This guide explains what happens behind the button and shows the code, so you can build your own.
What it does
Type a passage for 30, 60 or 120 seconds and get your words per minute, accuracy and mistakes. Mistakes are highlighted as you type. Choose easy words, sentences or code.
When to use it
- Practising for typing tests and job applications
- Measuring improvement
- Fun competitions
How to use it
- Pick the time and text type.
- Start typing to begin the timer.
- Read your WPM and accuracy.
Try it free in your browser, nothing is uploaded: https://eskillsfy.com/tools/typing-speed-test
How it works
Typing speed is measured in words per minute, where a ‘word’ is 5 characters. WPM = correct characters ÷ 5 ÷ minutes. Raw WPM counts every typed character, and accuracy is correct ÷ typed.
The timer starts on the first key press. Each character of the target text is coloured by comparing it to what was typed at the same position.
Build it yourself
Here is the core of the tool. It has no dependencies unless noted, so you can paste it into any TypeScript or JavaScript project.
wpm.ts (ts)
export function score(target: string, typed: string, ms: number) {
const correct = [...typed].filter((c, i) => c === target[i]).length;
const minutes = ms / 60000;
return {
wpm: Math.round(correct / 5 / minutes),
raw: Math.round(typed.length / 5 / minutes),
accuracy: typed.length ? Math.round((correct / typed.length) * 100) : 100,
};
}
Make it production-ready
- Save best scores in localStorage.
- Add practice for numbers and symbols.
Questions
What is a good WPM?
About 40 WPM is average. 60+ is fast, and professional typists reach 80 to 100.
Free, runs in your browser, nothing is uploaded.