.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.

What opens 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.

Windows

  • any text editor
  • VS Code

macOS

  • any text editor
  • VS Code

Linux

  • any text editor
  • VS Code

Open a .editorconfig file step by step

  1. Confirm the file really is a .editorconfig. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
  2. On Windows, open it with any text editor or VS Code.
  3. On Mac, use any text editor or VS Code.
  4. On Linux, try any text editor or VS Code.
  5. Still stuck? Search for a dedicated EditorConfig viewer rather than a generic one.

Why can't I open my .editorconfig file?

Almost always because no installed app understands EditorConfig. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.

The other possibility is that the file is not really a .editorconfig at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.

EditorConfig has no fixed magic number, so there is no signature table on this page. Its bytes alone do not prove the format: identification relies on the extension, the structure of the content and the program that created it. The magic-numbers reference lists the formats that do carry one.

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. How sources are ranked and what is deliberately left out is set out in the methodology.