How to use it
- Choose the indentation in Indent with and Indent size. Choose the line break in End of line and the encoding in Character set.
- Tick the file-type sections you need: Keep trailing spaces in Markdown, Indent YAML with two spaces and Indent Makefile recipes with tabs.
- Copy the text in The .editorconfig file, or download it, and save it in the top folder of your project.
- Read What each line means to check what every property does.
How the file works
Many editors and IDEs read an .editorconfig file and apply its settings to the files that match each section. A section header is a file-name pattern in square brackets, and the properties under it apply to every matching file. A later section overrides an earlier one for the same property. The line root = true stops the search, so the settings reach only this folder and the folders below it.
- * matches any characters except a slash.
- ** matches any characters, slashes included.
- {yml,yaml} matches either text, so *.{yml,yaml} matches both kinds of file.
The file-type sections
- Markdown: two spaces at the end of a line make a line break, so the trim is turned off for *.md.
- YAML: tab characters are not allowed for indentation, so *.{yml,yaml} is indented with spaces, two to a level.
- Makefile: each recipe line must start with a tab character, so Makefile gets indent_style = tab.
Choosing the values
- Spaces are the common choice for code. Tabs suit a team whose editors all show a tab at the same width.
- LF is the usual line break for projects on Linux and macOS and in most repositories. CRLF is the line break of Windows text files.
- UTF-8 is the standard encoding. Use UTF-8 with a byte-order mark only when a tool needs one.
Worked example: the default choices
With spaces, an indent size of 2, LF, UTF-8, trailing spaces removed, a final line break, and the three file-type sections, the file has a root line, one section for all files with six properties, and one property in each of the Markdown and Makefile sections, plus two in the YAML section. The table lists eleven property lines, and six of them are shown here.
| Section | Property | Value |
|---|---|---|
| Top of file | root | true |
| All files | indent_style | space |
| All files | indent_size | 2 |
| Markdown (.md) | trim_trailing_whitespace | false |
| YAML (.yml, .yaml) | indent_style | space |
| Makefile | indent_style | tab |
Frequently asked questions
Where should the .editorconfig file go?
In the top folder of the project, next to the README. Editors look for it in the folder of each file and then in every folder above, and the search stops at the first file that has root = true.
Does an .editorconfig file reformat my code?
Not by itself. It tells editors and plugins which indentation, line breaks and encoding to use when they edit or save a file. A formatter or a linter does the reformatting, and some of them read the same settings.
Why does the Markdown section keep trailing spaces?
In Markdown, two spaces at the end of a line make a line break. Removing them would join two lines into one, so this section turns the trim off for .md files only.
Why must a Makefile use tabs?
make reads each recipe line after a tab character, and a recipe that starts with spaces is an error. The Makefile section therefore sets indent_style to tab for files named Makefile.
Can a subfolder remove one of these settings?
Yes, with the value unset, which removes a property set earlier. This page writes plain values only, so add that line in the subfolder's own .editorconfig file if you need it.
Is the file sent to a server?
No. The file is written in your browser from the choices you make, and nothing you choose is stored.
Sources
- EditorConfig: the file format and the supported properties
- EditorConfig specification: sections, globs and root
- CommonMark 0.31.2: hard line breaks (two spaces at the end of a line)
- YAML 1.2.2: tab characters must not be used in indentation
- GNU Make manual: a recipe line begins with a tab character
Figures and text last checked on Tuesday, November 10, 2026.