How to Unminify/Beautify HTML, CSS & JavaScript in Sublime Text

Sometimes you will end up working with HTML/CSS/JavaScript code that is either poorly formatted or even minified. There are plenty of online tools that will unminify your code such as this one, but wouldn't it be nice to have that functionality right inside the Sublime Text editor?

 

Sublime Text doesn't come with a built-in code beautifier but you can install one called htmlprettify. To do this you will need to have already installed Package Control for Sublime.

 

Install htmlprettify

From within Sublime, open the command palette by typing CMD+SHIFT+P (CTRL+SHIFT+P on Windows) and then type "install", hit enter when you see "Package Control: Install Package".

 

Install Package

 

A window will appear – begin typing "htmlprettify" and when a matching result appears, hit enter to install the package.

 

Now you can highlight the code to prettify, right-click and select HTML/CSS/JS Prettify > Prettify from the top of the menu.

 

Cleaning code structure