Code Typing Test

Type the snippet line by line, with Enter at the end of each line.

Type each word and press space after it. Press Enter at the end of a line. The clock starts on your first key. def count_words(text): counts = {} for word in text.lower().split(): counts[word] = counts.get(word, 0) + 1 return counts print(count_words("the cat and the hat"))
More options

–This run

–Your best

–Last run

1 minute of typing. Words per minute is correct characters divided by five; accuracy is correct keystrokes out of all keystrokes.

No runs yet. Your last ten will show up here.

Saved in this browser

How it works

This code typing test gives you 20 short snippets full of brackets, colons and quotes: six in Python, six in JavaScript, four in Java and four in SQL. Every one runs. The indent of each line is shown, not typed.

Read the full guide

Pick a snippet, then type it

The test opens on Count the words in a string. Choose another from the list of snippets, sorted by language. Type each line as shown and press Enter at the end of it. Capitals and every symbol count.

Why code is slower than prose

Code packs in symbols that need Shift and the little fingers, and few of the letter patterns your hands know. Speed counts five characters as a word, so a line of brackets weighs as much as a line of words.

  • Type the closing bracket and quote yourself, even though your editor adds them. It is the key you never practise.

Questions and answers

Do I have to type the spaces at the start of a line?

No. The indent is shown but not typed, as in an editor that indents for you. Start from the first character you see and finish the line with Enter.

Is there a typing test for programmers in one language only?

The list sorts the snippets by language: Python, JavaScript, Java and SQL. Pick from one group and stay there. With No timer a run ends when the snippet does.

Does the code run?

Nothing runs on this page, but every snippet was run before it was added, so you type working code, not a jumble of symbols. The source note under the tool says how each language was checked.

All 20 snippets

Python 6

  • Count the words in a string A dict, a for loop and .get() with a default. Colons and indents on every block.
  • Squares of the even numbers A list comprehension with a condition, then an f-string with braces inside quotes.
  • A small class with two methods self, double underscores and a method that returns a comparison.
  • Sort a dict by its values sorted() with a lambda key, tuple unpacking and format widths after a colon.
  • Turn text into a number safely try and except with a tuple of errors, and a default argument.
  • Slices and string methods Square brackets with colons and minus signs, then join() on a string.

JavaScript 6

  • Average of a list An arrow function, the ternary operator and reduce() with a starting value.
  • Pull values out of an object Destructuring with a default, and a template literal with backticks and ${}.
  • Filter, then map A chain of array methods, one per line, each with an arrow function.
  • Count down with async and await A Promise wrapped round setTimeout, and a loop that waits on each step.
  • Name a key code with switch switch, case and default, with a return on each line.
  • Check an address with a pattern A regular expression: slashes, carets, square brackets, backslashes and braces in one line.
Show all 20 snippets (8 more)

Java 4

  • A whole program that prints a line A class, a main method, String[] and a semicolon at the end of the statement.
  • Find the best time in an array An array literal in braces, a for-each loop and an if inside it.
  • Build a list of strings Angle brackets for the type, the diamond <> and dotted method calls.
  • Pick a word with the ternary operator A question mark and a colon, then printf with percent signs.

SQL 4

  • Make a table Parentheses across lines, commas at line ends and column rules in capitals.
  • Add two rows Single quotes round text, and rows in brackets split by a comma.
  • Select, filter and sort Four clauses, one per line, and a comparison with >=.
  • Group and count COUNT(*), AVG(), AS for a new name, and HAVING after GROUP BY.

How this list was compiled: Twenty snippets written for this page, each an everyday idiom a few lines long, not taken from any project, book or course. Every snippet was run on 2026-09-24 before it was added: the Python ones with Python 3.14, the JavaScript ones with Node.js 22, the Java ones compiled and run with JDK 17 (the four that are not whole programs inside a main method, with java.util imported), and the four SQL statements together in SQLite 3, in the order make, add, select, group. The page names each language only to sort the snippets; it is not affiliated with anyone who owns a language name. Licence: own work