.editorconfig

What is a .editorconfig file?

EditorConfig Coding-Style File · Code and data · EditorConfig project · 2011

An .editorconfig file defines basic coding style (indentation, line endings, charset, trailing whitespace) for a project, so every editor and IDE formats files the same way regardless of personal settings.

Category
Code and data
MIME type
Type
Plain text
Is a .editorconfig file safe to open? Safe. An .editorconfig file is a plain-text style declaration read by editors; it does not execute.

What is a .editorconfig file used for?

The format is INI-like: [*.py] or [*.{js,ts}] sections set properties such as indent_style, indent_size, end_of_line and insert_final_newline. Editors read the nearest .editorconfig up the folder tree until one says root = true.

Most modern IDEs (VS Code via extension or built-in, JetBrains, Visual Studio) honour it out of the box, which is why the file appears in so many repositories: it ends tabs-versus-spaces arguments at the tooling level.

How to open a .editorconfig file

The .editorconfig format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list. For a step-by-step walkthrough, see how to open a .editorconfig file.

Windows

  • any text editor
  • VS Code

macOS

  • any text editor
  • VS Code

Linux

  • any text editor
  • VS Code

.editorconfig file signature (magic bytes)

Programs recognise a .editorconfig file by the bytes at the start of the file, not by its name. These are the signatures for EditorConfig.

Hex signatureOffsetNote
(no fixed signature)0plain text; no fixed magic bytes

See the full magic-numbers reference for every format.

Frequently asked questions

What is a .editorconfig file?

An .editorconfig file defines basic coding style (indentation, line endings, charset, trailing whitespace) for a project, so every editor and IDE formats files the same way regardless of personal settings.

What does an .editorconfig file do?

It tells editors how to format files in the project: tabs or spaces, indent width, line endings and charset, so the style stays consistent across the team.

Do I need a plugin for .editorconfig?

JetBrains IDEs and Visual Studio support it natively; VS Code needs the small official EditorConfig extension. Most other editors have a plugin.

What does root = true mean?

It stops the upward search. Editors read every .editorconfig from the file's folder up the tree and stop at the first one marked root = true.

Related formats

Sources

Details on this page were checked against authoritative references: