EditorConfig generator — one .editorconfig for every editor

Choose spaces or tabs, the indent size, line endings and a few per-language exceptions, and the tool writes an .editorconfig file that most code editors read automatically.

Live demo · real result from this tool
Indent with
Line endings

.editorconfig

# EditorConfig — https://editorconfig.orgroot = true [*]indent_style = spaceindent_size = 2end_of_line = lfcharset = utf-8trim_trailing_whitespace = trueinsert_final_newline = true # Two trailing spaces are a line break in Markdown[*.md]trim_trailing_whitespace = false [*.{yml,yaml}]indent_style = spaceindent_size = 2 # Make requires tabs[{Makefile,makefile,*.mk}]
indent_style = tab

Processed on your device — nothing is uploaded.

How to use the EditorConfig generator

  1. Choose Indent with: Spaces or Tabs, and set the Indent size (1–8).
  2. Pick Line endings (LF or CRLF) and the Charset: UTF-8, UTF-8 with BOM or Latin-1.
  3. Keep Trim trailing whitespace and Final newline ticked unless you have a reason not to. Set Max line length if you want a ruler, or leave 0 for off.
  4. Tick the exceptions you need: Keep trailing spaces in Markdown, YAML: 2 spaces, Python: 4 spaces and Makefiles: tabs.
  5. Save the output as .editorconfig in the root of your repository.

What it does and when to use it

When people on one project use different editors, small differences creep in: tabs in one file, spaces in the next, Windows line endings in a third. An .editorconfig file makes every supporting editor use the same basic settings for each file type.

Use it at the start of any shared project, or when diffs are full of whitespace noise. It works alongside the Prettier config generator, which reformats code, and the ESLint config generator, which checks it. If you use a Makefile, keep the tab rule ticked so editors do not turn the tabs in the Makefile generator output into spaces.

How it works

The file is plain INI-style text read from top to bottom. A [*] section sets the defaults for all files, and later sections with a glob such as [*.py] override them for matching files. The EditorConfig site lists every property.

  • With Spaces, the tool writes indent_size with your number.
  • With Tabs, it writes indent_size = tab and tab_width with your number, so the width of a tab is defined too.
  • Max line length is written only when it is above 0.
  • The Makefile section matches Makefile, makefile and *.mk, because make fails on lines indented with spaces.

Worked examples

Default settings. Two-space indentation and LF, with all three exceptions:

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

followed by [*.md] with trimming off, [*.{yml,yaml}] with 2 spaces and [{Makefile,makefile,*.mk}] with tabs.

Tabs for a Python-and-Go team. Indent with Tabs, size 4, Python ticked, the other exceptions off. The [*] section has indent_size = tab and tab_width = 4, and a [*.py] section switches Python files back to 4 spaces, as PEP 8 recommends.

Windows-oriented project. CRLF, UTF-8 with BOM, max line length 120. The defaults read end_of_line = crlf, charset = utf-8-bom and max_line_length = 120.

Limits and tips

  • Existing files are not changed. Editors apply the settings as you edit; reformat old files once with a formatter.
  • Line endings in Git are also affected by core.autocrlf and .gitattributes; keep them consistent with this file.

Frequently asked questions

Which editors read .editorconfig?
Many support it out of the box, including JetBrains IDEs, Visual Studio and Neovim. VS Code needs the EditorConfig extension. The full list is on editorconfig.org.
What does root = true do?
It tells the editor to stop looking for more .editorconfig files in parent folders. Without it, a stray file higher up on your disk could change your settings.
Why does Markdown keep trailing whitespace?
In Markdown, two spaces at the end of a line create a line break. Trimming them would silently change how the text renders, so the Markdown section turns trimming off.
Is max_line_length enforced?
Not everywhere. It is not one of the core EditorConfig properties, and many editors only show a ruler or ignore it. Use a formatter such as Prettier if long lines must be wrapped.
Do I still need Prettier if I have EditorConfig?
They do different jobs. EditorConfig sets how your editor types new text, such as indent and line endings. Prettier reformats whole files. Prettier also reads some EditorConfig settings when it has no setting of its own.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close