Auto Format HTML in Sublime Text

If you’re looking to auto format HTML with Sublime Text, you’ll be disappointed to know that there isn’t a default command to do this. However, because of a healthy community of developers, there is a plugin to achieve this.

For instructions on how to install and use, refer to the project’s github page: Sublime HTML Prettify

2 thoughts on “Auto Format HTML in Sublime Text”

  1. You don’t need any plugins to do this. Just select all lines (Ctrl A) and then from the menu select Edit ā†’ Line ā†’ Reindent. This will work if your file is saved with an extension that contains HTML like .html or .php.

    If you do this often, you may find this key mapping useful:
    { “keys”: [“ctrl+shift+r”], “command”: “reindent” , “args”: { “single_line”: false } }

What do you think?