Articles
Published · November 1, 2026

What .editorconfig Actually Does (and Why Your Team Should Have One)

A .editorconfig file tells every editor on your team how to indent, end lines and encode files. Learn how it is found, matched and overridden.

Also in: Español中文हिन्दी

A .editorconfig file is a small text file that tells every editor on your team how to indent, end lines and encode files in a project. You commit it once, and tabs-versus-spaces arguments stop reaching your diffs.

This article covers where tools look for the file, how sections match files, what each property does, and a starter file you can copy.

What .editorconfig is and what it is not

EditorConfig is a file format plus editor support that keeps coding style consistent for multiple developers working across different editors and IDEs. The file is plain text, easy to read, and works well with version control.

What it isn't: a linter or a formatter. It tells your editor how to behave while you type and save. Lines you never touch stay as they are, and anything it can't express (naming rules, import order) belongs to other tools.

How tools find the file

The file must be named .editorconfig, in lowercase. According to the official specification, a tool starts in the directory of the file you opened and searches that directory and all its parents. The search stops when it finds a file with root = true, or when it reaches the filesystem root.

root = true

[*]
indent_style = space

root must sit in the preamble, before the first section header. Put it in the top-level file of your project, otherwise a stray .editorconfig in a parent folder can leak into your project.

Precedence is simple, and it always favors the more specific rule. Within one file, a later section beats an earlier one. Across files, the closer file beats the farther one. Keys are case-insensitive, and a value of unset removes the effect of that key even if a parent file set it.

Section globs

The format is based on INI. Each section header is a glob, similar to the patterns in a .gitignore file, and it uses forward slashes, even on Windows. According to the spec:

| Pattern | Matches | |---|---| | * | any characters except / | | ** | any characters, including / | | ? | one character except / | | [seq] / [!seq] | one character in, or not in, seq | | {a,b} | either string | | {1..5} | any integer in the range |

A glob that contains a / is relative to the directory holding the .editorconfig. One without a slash can match at any depth below it.

Comments start with # or ; at the beginning of a line. Inline comments are not supported: a ; or # later in a line is treated as text.

The core properties

The spec defines these keys:

| Property | Values | Notes | |---|---|---| | indent_style | tab, space | Tabs or spaces for indentation | | indent_size | a whole number, or tab | tab defers to tab_width | | tab_width | a whole number | Defaults to indent_size | | end_of_line | lf, cr, crlf | See CRLF vs LF line endings | | charset | latin1, utf-8, utf-8-bom, utf-16be, utf-16le | The spec discourages utf-8-bom | | trim_trailing_whitespace | true, false | Strips spaces before newlines | | insert_final_newline | true, false | Never added to empty files |

Two details save confusion. First, with indent_style = tab you can leave out indent_size, so each reader sets the tab width they like. Second, tab_width is only needed when it differs from indent_size.

Setting end_of_line and charset also prevents a class of invisible problems; if you have ever fixed encoding problems, you know why.

You may see max_line_length in other people's files. The spec gives it no meaning, and only some tools honor it. Treat it as a hint, not a rule.

Editor support and its limits

According to the project, Xcode, Vim, Neovim, Helix, BBEdit, Nova, IntelliJ-based IDEs and GitHub read the file natively. Visual Studio Code and Sublime Text need a plugin.

Plugin support varies, and not every plugin handles every property. Unrecognized properties are ignored, and anything you leave unspecified falls back to the editor's own settings. That keeps files forward-compatible. The catch: test your file in the editors your team actually uses.

A starter file for your team

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab

The [*.md] section comes later, so it overrides the global setting. Markdown uses two trailing spaces as a hard line break, so stripping them can change your output. The Makefile section keeps real tabs, which that format requires.

Commit the file at the repository root. If you keep personal settings in a dotfiles repository, leave .editorconfig in each project instead, so the rules travel with the code.

How Carets fits in

Carets is a native notes and code editor for iPhone, iPad and Mac. It handles Markdown, plain text and code in one place, with syntax highlighting for code and config files, organized into files, projects and tags. That makes it a quick way to open and edit a .editorconfig, a Makefile or a README on any of your devices without launching a full IDE. Your files stay plain text, so they stay portable.

Get Carets on the App Store for iPhone, iPad and Mac.

Frequently Asked Questions

Does EditorConfig reformat existing code?

Not by itself. It tells your editor what to do as you type and save. Existing lines stay as they are until you touch them. Reformatting a whole codebase needs a separate formatter.

Do I need root = true?

Put it in the top-level file of your project. Without it, tools keep searching parent directories, so a stray file in a parent folder can affect the project.

Does VS Code support .editorconfig?

It needs a plugin. The project lists Visual Studio Code and Sublime Text among the editors that require one, while Xcode, Vim, Neovim and GitHub read the file natively.

What about max_line_length?

The spec does not define it. Some tools honor it and others ignore it, so treat it as a hint rather than a rule.