How to Change Line Spacing in Anki

How to Change Line Spacing in Anki

Write enough content into an Anki card and it wraps onto multiple lines, which can make the card look cramped — especially if the line height is tight. When that happens, changing the line height in your card template makes it easier to read. This tip covers what Anki's default line height is, and how to change it.

Anki's Default Line Height

Anki's built-in note types (Basic, Basic (type in the answer), Cloze) have line-height: 1.5 in their styling. That means the line spacing is 1.5 times the font size.

The catch is that not every template has this setting. Note types from shared decks or templates made a while ago often lack line-height entirely, in which case the browser's default applies. In most browsers that's roughly 1.2 times the font size, which can make the same text look cramped.

You can check which one your template has right in ankieditor. Click an empty area to select the whole card, and look at the Line height field under "Text Style." 1.5 means Anki's default is set; if it shows 1.4, your template has no line-height setting (that's just the placeholder value the editor shows when there's none).

Recommended Line Heights

The best way to find the right line height for your Anki cards is to adjust it yourself and see how it looks. That said, here are a few recommendations.

  • A single word, one line of meaning — leave it at 1.5. With only one line, line height isn't even visible.
  • A two-to-three-line explanation or example — 1.6–1.7. Lines separate clearly, making them easier to skim.
  • Long prose with multiple paragraphs — 1.7. Though adding space between paragraphs works better than raising line height further.

These values are recommended starting points too, not measured optimums. The same value can look different depending on font and font size, so check the preview.

How to Change Line Height in ankieditor

  1. Click the part of the card you want to change in the preview to select it. Clicking empty space targets the whole card instead.
  2. Drag the Line height slider under "Text Style" in the left panel, or type a number into the box next to it. It adjusts from 1 to 3 in steps of 0.1.
  3. To widen spacing on just the example sentence field, click that field to select it, then change it the same way.
  4. Use [Copy Code] to copy the updated code and paste it into Anki's Tools → Manage Note Types → Cards... screen.

How to Edit Line Height Directly in CSS

Changing the whole card updates the .card rule in the styling area.

.card { line-height: 1.6; }

Changing just one field makes ankieditor issue a class named after that field and use it to write the rule.

.card { line-height: 1.5; }
.Example { line-height: 1.7; }

A number with no unit is a multiplier on the font size. Since the ratio holds even if you change the font size later, writing it unitless like 1.6 is better than a fixed value like 24px. If you want to change it, just edit that number directly in the code.

What to Watch Out for When Changing Line Height

Going past 2.0 can actually hurt readability. When lines get too far apart, a paragraph stops reading as one block and starts to feel like separate paragraphs instead.

Changing line height affects everything inside that field. Set it on .card and every field inside changes together. To make one field different, select it and set it separately.

Set this separately for each note type. Card templates are stored in the card types that belong to a note type, so if you use several note types, you'll need to apply it to each one.

Want Space Between Fields, Not Longer Lines?

Line height is different from the space between fields. It's the value that controls the space between lines inside a paragraph. But sometimes what you actually want isn't a line-height change — you want more space between fields. Raising line height won't fix that.

The solution is to add space between fields. In ankieditor, click an element in the preview to select it, and a "Space below" row appears under the selection. Click ➕ to add one blank line below that element each time, and ➖ to remove one — the current count is shown in between.

The trick is to keep things that should read as one group close together (a word and its pronunciation), and add space only between things that should read as separate (an answer and an example sentence).

Frequently Asked Questions

What is Anki's default line height?

Anki's built-in note types have line-height: 1.5 in their styling. Shared decks or older templates sometimes lack this setting, though, in which case the browser's default applies, showing roughly 1.2 times the font size.

What should I raise line height to?

For cards with explanations longer than two or three lines, 1.6–1.7 is recommended. Past 2.0, lines start to scatter and stop reading as one paragraph. Since it's a starting point, adjust it while watching the preview.

I changed line height, but nothing changed.

That happens when the card has only one line. Line height is the gap between lines, so it's invisible on a single-line card. Put a two-or-three-line sentence into a field's sample value to see the difference.

If it's long lines making things feel cramped, see How to Change Card Width in Anki; for building priority with font size, see How to Change Font Size in Anki.