[intellij-idea] How can I use tabs for indentation in IntelliJ IDEA?

How can I use tabs instead of multiple spaces for indentation in IntelliJ IDEA 11.0?

I have "Use tab character" checked under "Code Style" > "General" > "Default Indent Options". And also tried to have "Smart tabs" checked, but it doesn't help.

From the documentation:

If this check box is selected, tab characters are used:

  • On pressing the Tab key
  • For indentation
  • For code reformatting

Otherwise, spaces are used instead of tabs.

This question is related to intellij-idea indentation

The answer is


File > Settings > Editor > Code Style > Java > Tabs and Indents > Use tab character

Substitute weapon of choice for Java as required.


For those who are having trouble indenting phpstorm here I have a tip and I hope they help ...

First you have to go to file-> settings-> keymap-> select-> windows. enter image description here enter image description here

If they are on the windows machine. If you are on mac and choose macos.


For anyone not able to get this, another thing you need to uncheck the following as well

Preferences > Editor > Code Style
[] Enable EditorConfig support
EditorConfig may override the IDE code style settings

My IntelliJ version 15.0.4


My Intellij version is 13.4.1

Intellij IDEA->Perference->Code Style(Project Setting)

To expand on @Dmitiri Algazin 's answer: settings for individual languages are overridden by the general setting

Preferences -> Code Style -> Detect and use existing file indents for editing

So if you are wondering why your new settings are being ignored after changing your settings for a specific language, there is a chance this checkbox is ticked.

As a side note; changing any default settings automamagically creates a settings profile clone (i.e. Default(1)) which I assume is in place so that the default IDE settings are never overwritten.

It is a little confusing at first, really, whether editing Default settings or Project Settings is going to have any effect on your project, since you can select Default from the drop down menu and then edit from there.

If you don't want to keep seeing random clones of Default populating your settings profiles, edit the Project Settings directly.


Another useful option in IDEA to switch off or keep checked if you really need that:

Preferences -> Code Style -> Detect and use existing file indents for editing

if your team is going to switch to tab formatting with existing code written with spaces, uncheck that


I have started using IntelliJ IDEA Community Edition version 12.1.3 and I found the setting in the following place: -

File > Other Settings > Default Settings > {choose from Code Style dropdown}

Have you tried .editorconfig? You can create this file in the root of your project and configure indentation for different file types. Your code will be automatically formatted. Here's the example:

# top-most EditorConfig file
root = true

# matches all files
[*]
indent_style = tab
indent_size = 4

# only json
[*.json]
indent_style = space
indent_size = 2