Productivity
TYPING SPEED TEST
Test your typing speed and accuracy. Timer starts on first keystroke. Real-time WPM and accuracy tracking.
0
WPM
100%
Accuracy
0s
Time
0
Characters
Click the text above and start typing...
TEST COMPLETE
0
WPM
0%
Accuracy
0s
Time
0
Correct
Developer Reference
Core Algorithm & Standalone Script
Standalone, zero-dependency JavaScript implementation powering this tool. Free to inspect, copy, and build upon.
const passages = [
"The rapid advancement of technology has fundamentally transformed how we communicate, work, and navigate daily life. From smartphones that fit in our pockets to artificial intelligence systems that can compose music, the digital revolution continues to reshape our world in ways previously confined to science fiction.",
"Deep within the ancient forest, sunlight filters through a canopy of towering oaks and maples, casting dappled shadows on the moss-covered ground. A gentle stream winds through the undergrowth, its water crystal clear and cold, reflecting the ever-changing sky above like a ribbon of liquid glass.",
"Quantum mechanics reveals a universe far stranger than our everyday experience suggests. At the subatomic level, particles exist in multiple states simultaneously, entangled photons communicate instantaneously across vast distances, and the simple act of observation can fundamentally alter the outcome of an experiment.",
"The unexamined life is not worth living, proclaimed Socrates centuries ago, and his words still echo through the halls of modern thought. Philosophy challenges us to question our assumptions, explore the nature of reality, and seek meaning in a universe that often appears indifferent to our existence.",
"It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness. Every generation believes itself to stand at a unique crossroads of history, yet the fundamental struggles of the human condition remain remarkably consistent across the centuries.",
"The printing press, invented by Johannes Gutenberg around 1440, revolutionized the spread of knowledge across Europe and beyond. Books became affordable, literacy rates soared, and ideas could travel faster than ever before. This single invention laid the groundwork for the Renaissance, the Reformation, and the Scientific Revolution."
];
let currentPassage = '', pos = 0, startTime = null, timerInterval = null;
let correctCount = 0, wrongCount = 0, finished = false;
function loadPassage(idx) {
currentPassage = passages[idx];
resetTest();
}
function resetTest() {
pos = 0; startTime = null; correctCount = 0; wrongCount = 0; finished = false;
clearInterval(timerInterval);
document.getElementById('results').classList.remove('show');
document.getElementById('liveWpm').textContent = '0';
document.getElementById('liveAcc').textContent = '100%';
document.getElementById('liveTime').textContent = '0s';
document.getElementById('liveChars').textContent = '0';
document.getElementById('timerBar').style.width = '0%';
document.getElementById('hint').textContent = 'Click the text above and start typing...';
renderPassage();
}
function newTest() {
const idx = Math.floor(Math.random() * passages.length);
document.getElementById('passageSelect').value = idx;
loadPassage(idx);
}
function renderPassage() {
const box = document.getElementById('passageBox');
box.innerHTML = currentPassage.split('').map((ch, i) => {
let cls = 'char';
if (i < pos) cls += correctMap[i] ? ' correct' : ' wrong';
if (i === pos && !finished) cls += ' current';
return `<span class="${cls}">${ch === ' ' ? ' ' : ch.replace(/</g,'<')}</span>`;
}).join('');
}
const correctMap = [];
function handleKey(e) {
if (finished) return;
if (e.key === 'Backspace') {
if (pos > 0) {
pos--;
if (correctMap[pos]) correctCount--; else wrongCount--;
correctMap.length = pos;
renderPassage();
updateLive();
}
return;
}
if (e.key.length !== 1) return;
if (!startTime) {
startTime = Date.now();
document.getElementById('hint').textContent = 'Keep typing...';
timerInterval = setInterval(updateLive, 200);
}
const expected = currentPassage[pos];
const isCorrect = e.key === expected;
correctMap[pos] = isCorrect;
if (isCorrect) correctCount++; else wrongCount++;
pos++;
renderPassage();
updateLive();
if (pos >= currentPassage.length) {
finished = true;
clearInterval(timerInterval);
showResults();
}
}
function updateLive() {
if (!startTime) return;
const elapsed = (Date.now() - startTime) / 1000;
const totalChars = correctCount + wrongCount;
const wpm = elapsed > 0 ? Math.round((correctCount / 5) / (elapsed / 60)) : 0;
const acc = totalChars > 0 ? Math.round((correctCount / totalChars) * 100) : 100;
document.getElementById('liveWpm').textContent = wpm;
document.getElementById('liveAcc').textContent = acc + '%';
document.getElementById('liveTime').textContent = Math.round(elapsed) + 's';
document.getElementById('liveChars').textContent = totalChars;
document.getElementById('timerBar').style.width = Math.min(100, (pos / currentPassage.length) * 100) + '%';
}
function showResults() {
const elapsed = (Date.now() - startTime) / 1000;
const wpm = Math.round((correctCount / 5) / (elapsed / 60));
const acc = Math.round((correctCount / (correctCount + wrongCount)) * 100);
document.getElementById('finalWpm').textContent = wpm;
document.getElementById('finalAcc').textContent = acc + '%';
document.getElementById('finalTime').textContent = elapsed.toFixed(1) + 's';
document.getElementById('finalCorrect').textContent = correctCount + '/' + currentPassage.length;
document.getElementById('results').classList.add('show');
document.getElementById('hint').textContent = 'Test complete! Click "New Test" to try again.';
}
const box = document.getElementById('passageBox');
const input = document.getElementById('typingInput');
box.addEventListener('click', () => input.focus());
input.addEventListener('keydown', handleKey);
box.addEventListener('keydown', handleKey);
loadPassage(0);