How do I change XML indentation in IntelliJ IDEA? How do I change XML indentation in IntelliJ IDEA? xml xml

How do I change XML indentation in IntelliJ IDEA?


Sure there is. This is all you need to do:

  • Go to
File -> Settings -> Global Code Style -> General
  • Disable the checkbox next to 'Use same settings for all file types'
  • The 'XML' tab should become enabled. Click it and set the 'tab' (and probably 'indent') size to 2.


In IntelliJ IDEA 10.0.3 it's File > Settings > Code Style > General


Note: make sure to not use the same file in two project, or your settings might revert to the default (4 spaces), instead of the custom XML tab indent size.

See bug IDEA-130878, for the latest IntelliJ IDEA 14 (Oct 2014)