Indentation

A formatting technique that inserts whitespace at the beginning of a line to visually indicate the start of a paragraph or a hierarchical structure. In Japanese, a one-character indent is the standard convention.

Indentation is the practice of inserting whitespace at the start of a line to visually convey the structure of text. In Japanese writing, indenting the first line of a paragraph by one full-width space is the standard format, taught from elementary school composition classes onward. In English, the convention is either to indent the first line by four half-width spaces (or one tab) or to separate paragraphs with a blank line.

In programming, indentation is a crucial element that communicates code structure. In Python, indentation is part of the syntax itself: the depth of indentation determines the scope of a block. Other languages (JavaScript, Java, C, etc.) use curly braces {} to delimit blocks, so indentation is not syntactically required, but consistent indentation is strongly recommended for readability.

The choice between tabs and spaces for indentation has been a long-running debate among programmers. A tab character (U+0009) is a single character whose display width can be configured per editor, but its appearance varies across environments. Spaces produce a consistent display but consume 2 to 4 characters per indentation level. From a character-counting perspective, one tab and four spaces look the same on screen yet yield different character counts.

On the web, HTML collapses consecutive spaces into one, so indentation must be achieved with the CSS text-indent property. Setting text-indent: 1em produces a one-character indent. Inside a <pre> element, spaces and tabs are rendered as-is, preserving the indentation of code blocks.

On Japanese manuscript paper (genkouyoushi), paragraph indentation takes up one square (one character). On a 400-character sheet with 10 paragraphs, indentation alone consumes 10 characters. For assignments with a character limit (e.g., an 800-character essay), reducing the number of paragraphs saves characters spent on indentation, though too few paragraphs makes the text harder to read.

In email and chat, the ">" symbol is used as an indentation marker for quotations. The convention of prefixing quoted text with ">" in email replies originated in UNIX mail clients. Markdown also uses ">" for block quotes. Each ">" counts as one character, so deeply nested quotations (>>>) increase the character count accordingly. Programming books on Amazon cover indentation best practices across languages.

Share this article