For this we generally use Visual Studio for formatting. But, we have So many Online editors / formatters available.
In Online editors, I feel comfortable working with http://jsbeautifier.org/ (Open Source)
Want to give a try, check website.
Please comment on this article.
Hope you like it 🙂