EditorConfig Generator

.editorconfig
Results

An .editorconfig at the repo root tells every modern IDE how this project formats its files, settling the tabs-vs-spaces argument file by file. Python: 4 spaces. JavaScript: 2. Makefile: tabs (required). This generator builds an .editorconfig from your formatting choices (indent style and size, line endings, charset, max line length, final newline, trailing whitespace) and always includes the common tweaks: [*.md] keeps trailing whitespace for Markdown line breaks, and [Makefile] uses tabs as make requires.

How to build an .editorconfig

  1. 1

    Set the global defaults

    Charset (utf-8 default), end of line (lf vs crlf), indent style and size, max line length, insert final newline, trim trailing whitespace.

  2. 2

    Check the built-in tweaks

    The generator always adds `[*.md]` with `trim_trailing_whitespace = false` (Markdown needs trailing spaces for line breaks) and `[Makefile]` with `indent_style = tab`, which make itself requires.

  3. 3

    Copy the file

    Use the copy button to grab the generated `.editorconfig` and drop it at the repo root.

  4. 4

    Extend it later

    Need per-language rules? Append your own sections, for example `[*.py]` with `indent_size = 4`.

What .editorconfig does

A file named .editorconfig at the root of a project (or in any directory) declares formatting conventions. Editors with EditorConfig support (every major IDE and most modern text editors) apply those rules on file open.

Sample output

With the default settings (spaces, indent size 4, LF, utf-8) the generator emits:

root = true

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

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab

Key directives

Directive Accepted values Notes
root true / false Set true at project root so the lookup stops
charset utf-8, utf-8-bom, latin1, utf-16-be, utf-16-le utf-8 is the default
end_of_line lf, crlf, cr lf for cross-platform; crlf for Windows-only repos
indent_style space, tab
indent_size integer Number of spaces, ignored when tab
tab_width integer Visual width of a tab (default indent_size)
insert_final_newline true / false Ensures POSIX-compliant files
trim_trailing_whitespace true / false Turn off for Markdown (trailing spaces mean line breaks)

Language conventions at a glance

Language / file Convention
JS, TS, JSON 2 spaces
HTML, CSS, YAML 2 spaces
Python 4 spaces (PEP 8)
PHP 4 spaces (PSR-12)
Ruby 2 spaces
Go Tabs (gofmt enforces)
Rust 4 spaces (rustfmt enforces)
Java 4 spaces
Makefile Tabs (required by make itself)
Markdown Keep trailing whitespace (used for <br>)
Batch/CMD (.bat) crlf line endings

Trap: Markdown trailing whitespace

In Markdown, two trailing spaces at the end of a line mean “insert a <br> here”. If your .editorconfig trims trailing whitespace for all files, those line breaks vanish. Override with trim_trailing_whitespace = false for [*.md].

Does your IDE support it?

Native support: VS Code, JetBrains IntelliJ family, Sublime Text, Vim (via plugin), Emacs (via plugin), Atom, Notepad++, Xcode. If an editor does not support EditorConfig out of the box, it usually has a plugin. The file is also machine-readable so linters and formatters can honor it.

Frequently Asked Questions

At the project root with root = true. You can add additional .editorconfig files in subdirectories to override specific paths; the lookup walks up the tree and stops at the first root = true file it finds.

No. EditorConfig handles whitespace and line-ending basics across every editor. Prettier and language-specific linters handle deeper style rules (quotes, semicolons, trailing commas). The two complement each other.

Set end_of_line = crlf if Windows tooling in the repo actually requires it. Better option: commit end_of_line = lf and add a .gitattributes with * text=auto so git normalizes line endings on commit while checkouts are OS-appropriate.

No. Your choices are used only to build the file; nothing is stored on our servers or kept after you leave the page.

Related Tools

Tool available in other languages