Imagine you could speed up your learning and better remember programming fundamentals, techniques, and commands.

Today I tell you how to do just that, using spaced repetition and a free open source tool called Anki.

Many have attested to the benefits of spaced repetition:

Jeopardy! champion Robert Craig says he owes some of his success to using Anki for memorizing trivia.

Googley as Heck, who studied full-time for 8 months for a Google interview, says “Spaced repetition is the key to memorization…You become an expert by revisiting and reviewing over time. If you do so, you’ll get to the point where [you] can’t forget details.”

And Derek Sivers, founder of CDBaby, writes that spaced repetition is “the most helpful learning technique I’ve found in 14 years of computer programming.”

For me personally, Anki has been an indispensable part of my effort to learn to code. I use it to remember important ideas from HTML, CSS, JavaScript, and commands from Git and Bash.

I’m currently in deferral at UC-Berkeley Law School, and Anki will 100% be part of my strategy to master the law.

In this article, I’ll cover:

What spaced repetition is

How Anki helps with spaced repetition

And how these can speed up your learning and improve your retention of programming concepts.

What is Spaced Repetition?

Spaced repetition seeks to solve the problem of forgetting. It holds that the ideal moment to remember a new piece of information is at the moment you are about to forget it.

For example, suppose you don’t know the capital of Colombia. And suppose right now I tell you what the capital of Colombia is.

The capital of Colombia is Bogotá.

Let’s assume your memory is such that you’ll remember this new fact—that the capital of Colombia is Bogotá—after your very first exposure to it, for a clean 20 minutes. After which you’ll forget.

But, if at 19 minutes and 59 seconds, while we’re having a cup of coffee, I remind you…

The capital of Colombia is Bogotá.

…spaced repetition theory says you’ll be able to remember Bogotá is the capital of Colombia for now say 40 minutes. After which you’ll forget.

But, if I remind you again 39 minutes and 59 seconds later that…

The capital of Colombia is Bogotá.

…you’ll be able to retain this piece of geographic trivia in memory for an even longer period, let’s say up to one hour.

And if we continue to proceed in this manner, where I keep reminding you the capital of Colombia is Bogotá precisely at the moment you’re about to forget, the time in between memory lapses grows exponentially from hours to days, then to months, then to years.

And eventually, as the theory goes, the knowledge — that Bogotá is the capital of Colombia — will be more or less permanently lodged in your memory.

This notion of a decline in memory over time is known as the forgetting curve, and it was developed by Herman Ebbinghaus in 1885.

Stahl et al 2010; CNS Spectr

And this idea — that it’s more efficient and effective to space out learning over time as opposed to cramming — is known as the spacing effect.

Together, the forgetting curve and the spacing effect are the fundamental concepts behind spaced repetition.

Depending on your forgetting curve, you determine the optimal interval to remind yourself of a memory item (meaning any piece of information), and you space out reinforcement of the memory item accordingly. Piotr Woźniak, a pioneer in memory research, sums up these ideas:

Optimum intervals are calculated on the basis of two contradictory criteria: 1. Intervals should be as long as possible to obtain the minimum frequency of repetitions, and to make the best use of the so-called spacing effect, which says that longer inter-repetition intervals, up to a certain limit, produce stronger memories 2. Intervals should be short enough to ensure that the knowledge is still remembered

At this point, you might be asking, “but how do you know precisely the moment you’re about to forget that the capital of Colombia is Bogotá? How do you know what your optimal interval is?”

Of course it’d be quite difficult to know down to the second without much painstaking trial-and-error and a Charles Darwin-level attention to detail. But fortunately we don’t need such diligence because a familiar friend can help us: software.

(You can also use a non-automated system called the Leitner system.)

Software, built on a mountain of memory research, can help you determine the optimal time to reinforce memorization. And specifically Spaced Repetition Software.

What is Anki?

Anki is an open source Spaced Repetition Software tool developed and maintained by Damien Elmes. You can think of it as a kind of “smart flashcard program” that leverages spaced repetition and makes memorization more efficient.

Anki is built on top of the premise that you best remember knowledge with periodic and strategically-timed reminders. Which means it’s built on top of the powers of spaced repetition.

You can use Anki to remember virtually anything that needs remembering.

Note, however, Anki is not a replacement for learning. You must first understand the material you’re learning, and then commit it to Anki, which will brilliantly help you retain the knowledge you’ve acquired. Meaning Anki is a part of the learning process that comes after understanding.

There’s other space repetition software in the world such as SuperMemo, created by the aforementioned Piotr Woźniak. Anki in fact implements a version of the algorithm that powers SuperMemo.

I focus here on Anki because it’s what I’ve become accustomed to, it works well, and it’s open source and free. If you’ve used SuperMemo or another SRS tool, let us know about your experience in the comments.

If you end up deciding to use Anki too, I nonetheless encourage you to read up on Woźniak and what he’s had to say about memory and learning and creativity because it’s highly insightful.

As far as devices go, Anki comes in a desktop version which, if you haven’t used Anki before, is recommended you start with. There’s also:

A free companion web app, AnkiWeb.

A free companion Android app AnkiDroid, fully compatible and synchronizable with Anki desktop/web.

And for iPhone users, a $24.99 companion app AnkiMobile in the AppStore.

How Anki works

Know that you can go deep into how you use and configure Anki. I only give you a high-level overview so you get the gist.

You create “decks,” which are a group of cards representing a broad category. For example, “JavaScript” or “Capitals” might be a deck.

Here’s an example of an Anki deck in the desktop app. (Don’t worry about the “New,” “Learning,” “To Review” for now. I’ll come back to these in a moment):

Example Anki deck

2. You add “cards” to your decks, which are customizable with HTML and CSS.

A card might be a standard front-and-back flashcard, where you’re first presented with the front. Here’s an example from a deck on “Capitals”:

Example Anki card — front of Basic type

And when you’re ready for the answer, you hit Show Answer to reveal the answer on the back of the card:

Anki card — front and back of Basic type

ProTip: there are other card types, besides the front-and-back flashcard type, like cloze deletion you’ll want to become familiar with. Cloze deletion is a particularly useful card type I use all the time (in fact most of my cards use cloze deletion) because it’s simple and effective at organizing information.

ProTip: creating Anki cards is an art. And the more you practice, the better you’ll get. As a rule-of-thumb, you’ll want to try to follow the minimum information principle, which essentially means:

KISS — Keep it Simple Stupid. You want to keep your cards as simple as possible because simple is easier to remember.

3. Once you’re done adding cards, you Anki (practice).

Let’s look back at the Colombia-Bogotá card to see how the process works.

Choose when you’d like to be reminded again

After you click Show Answer and you’re brought to the back of the card, you ask yourself:

How difficult was it to come up with the answer?

If you didn’t know the answer, you might choose Again , which will expose you to the card again in less than a minute .

, which will expose you to the card again in . If you came up with the answer after pausing and digging into your memory bank, you might select Good , which will show you the card again in less than 10 minutes .

, which will show you the card again in . And if the answer was easy, you choose Easy and you won’t see the card again for four days.

Anki’s program then keeps track of the state of your progress: which cards to review and when. Which means Anki is doing the tedious work of tracking your forgetting curve for each and every card.

This is the power of automating spaced repetition with software.

I should point out that you can change some of the variables of Anki’s spaced repetition algorithm. You do so by going into your deck options and customizing what you want to customize, such as the number of reviewable cards per day, the time interval options, among other variables.

Customizing your deck options

In the beginning, though, perhaps you might want to leave these settings alone and just use the defaults. And as you become more comfortable with Anki, you can start to be creative with the deck options.

To re-visit our JavaScript deck:

Example Anki deck

New means you’ve added 4 new cards to your JavaScript deck and they’re ready to be reviewed

means you’ve added 4 new cards to your JavaScript deck and they’re ready to be reviewed Learning means, if you’re in the middle of working through a deck and you chose, say, Good <10m , Anki will store that card in the learning queue and show it to you again in 10 minutes. See here for more details.

means, if you’re in the middle of working through a deck and you chose, say, , Anki will store that card in the learning queue and show it to you again in 10 minutes. See here for more details. To Review means the number of cards outstanding for review.

And all this will become much clearer the more and more you use Anki.

How to get started with Anki

Regarding tutorials and how to use Anki, the docs on the website are phenomenal and will probably answer most of your questions. And there are also a few helpful video tutorials.

In the meantime I give you a checklist on how to get started with Anki because checklists can be helpful.

1. Read Derek Siver’s article on spaced repetition because it reinforces much of what I talked about.

2. Read this Wired interview with Piotr Woźniak because it gives you a holistic overview of spaced repetition, learning, and memory research.

3. Read Effective learning: Twenty rules of formulating knowledge by Piotr Woźniak because it gives you techniques for how to formulate and structure your Anki cards.

Notably, remember that spaced repetition is not a substitute for learning. It is critical you first understand the material before you commit it to spaced repetition. First understand and then reinforce with Anki. Remember to use the KISS method to create cards, and to use imagery in your cards when possible.

4. Create your own decks.

5. Remember to keep your decks broad and general. For example, if you’re learning JavaScript, don’t create one deck called “Closures” and another called “Prototypal inheritance.” Instead create one “JavaScript” deck. Refer to Using Decks Appropriately in the documentation for more details.

6. Become one with cloze deletion because it’ll help your learning tremendously.

7. Understand the downsides.

There are a few downsides to space repetition. Interference in recall is one.

For instance, you can imagine experiencing interference in recall with, say, the capitals of Martinique, Marituania, and Mauritius because they’re all similarly named.

Some interference is hard to escape, and you might want to implement other memory hacks in such cases. But you can limit the downside by keeping your cards simple.

Learn more about the downsides here (scroll down to downsides) and here (scroll down to combat interference).

9. Remember to keep your cards and decks synced. Choose one “home base” like the desktop version and then sync with AnkiWeb and one of the mobile apps each time you make a change. You put in effort to create your cards and decks. Avoid the headache of having to redo your work.

9. Make Anki a habit. In order to see the fruits of Anki’s magic, you must make a decision and commit to going through your cards every day they’re due. Associate Anki with a cup of coffee. Or the morning. Or lunch time. Or something positive. Find ways to make Anki a habit.