Time-Savers: Code Beautifier And Formatter


Well-documented and readable source code is essential for every collaborative project. Logically structured, well organized and nicely formatted, the code can speed up the bug hunting and help to keep the code clean, minimal and still functional. These aspects are particularly important if the code is being developed by a group of developers: in this context a common scheme for source code presentation is necessary. You don’t have to do everything by hand; in fact, there are many tools which can save a lot of time – for you and your co-workers.

The tools and services we’ve collected below aren’t validators. They format and beautify the code; some of them can remove redundant elements. Using them, you have to make sure you have a backup, so your data can always be restored.

Let’s take a look at code beautifier and formatter which can save you a lot of time and help to maintain a clean and readable source code.

Code Beautifier And Formatter

1. Quick Highlighter1
Quick Highlighter can format source codes written in over 85 languages – among them C++, PHP, Ruby, HTML, JavaScript, Perl, Python, Smarty, XML and more. The tool formats source code and highlights inbuilt keywords, data types etc.


2. PrettyPrinter3
Knows PHP, Java, C++, C, Perl, JavaScript, CSS. The service offers many formatting options you can use to present the code just the way you’d like it to look like.


3. PHP Code Beautifier5
This tool is designed to beautify PHP code, applying most of the PEAR standard requirements to it. It can even process really scrambled scripts, e.g. all code in one line, and thus may help you to get scripts into a more readable form. It sets missing line breaks without removing any additional line breaks that you may use to group related things and corrects wrong indentation according to the level of nested braces.

4. Ruby Script Beautifier6
Ruby Beautifier accepts a command-line list of file names, creates a backup copy of each named file and beautifies the originals. If there is an indentation error (an imbalance of opening and closing keywords), the script will print an error message but will save the result anyway.

5. Tabifier7
The tabifier is a tool to properly indent computer code. The style it produces is a mix of my personal preferences for indentation plus what I could manage to make a program produce from dirty source. The tabifier currently supports CSS, HTML, and C Style code; the latter being anything that uses curly braces to start and end blocks, and semicolons to terminate statements.


6. CSS Beautifier9
This tool offers a variety of options, among them – Alphabetizing Feature and De-Capitalization Feature.


7. CSS Formatierer und Optimierer11
Has different compression layouts; you can sort selectors, properties, regroup selectors, optimize shorthands, compress colors, compress font-weight, discard invalid properties and add timestamps. You can also create a custom template the system will use to format the code. The result can be outputted as a file. A copy / mirror of the tool can be found on cleancss.com12.


8. Highlight.js14
Highlight.js highlights syntax in code examples on blogs, forums and in fact on any web pages. It’s very easy to use because it works automatically: finds blocks of code, detects a language, highlights it. Also available as WordPress-Plugin and Firefox-extension. Suported languages: Python, Ruby, Perl, PHP, HTML, CSS, Django, JavaScript, VBScript, Delphi, Java, C++, SQL. Similar tools is offered by Google: Googles Javascript Code Prettifier15.


9. Code Beautifier Plus18
Beautifies Java, C# and ActionScript.


10. PHP Formatter20
PHP formatter adds comments after control structures, colors the output, links to the php-manual by inline-functions, removes comments and removes empty lines. There are 5 pre-defined layouts, but you can also define your own styles.


11. PHP_Beautifier22
A tool to beautify PHP 4 and PHP 5 source code – to run on your own server. Requires PHP 5.

12. Online Beautifier for JavaScript23
The tool completely reformats the JavaScript source code, so that it becomes a little bit more readable.

13. Lorins simple code beautifier for C++, C#, Java, and Javascript24
You can use the source code of this beautifier to creat your own code formatters.

14. Tidy25
A classic. Tidy consists of many program libraries and comes and has many variations. E.g. you can use


Commercial Solutions

15. SourceFormatX Source Code Formatter & Beautifier34
For developers. The tool supports neither HTML nor CSS; instead Javascript, VB, PHP, ASP, JSP, HTC, C, JAVA and more. Price: $36,99, Windows.


16. Polystyle36
Polystyle automatically reformats source code in your personal style. Polystyle learns your formatting style by examining examples of your code. It is another Windows-tool which supports Actionscript, ASP, C/C++, C#, CMAC, CSS, HTML, Java, Javascript, JSP, PHP, Pascal/Delphi, Perl, Python and Visual Basic. Price: 79$, can be used from the shell and Windows Explorer.

Further Solutions

17. phpCodeBeautifier37 (Win/Linux Shell), HTB 2.038 (Shell).


  1. 1 http://quickhighlighter.com/
  2. 2 http://quickhighlighter.com/
  3. 3 http://www.prettyprinter.de/
  4. 4 http://www.prettyprinter.de/
  5. 5 http://www.tote-taste.de/X-Project/beautify/
  6. 6 http://www.arachnoid.com/ruby/rubyBeautifier.html
  7. 7 http://tools.arantius.com/tabifier
  8. 8 http://tools.arantius.com/tabifier
  9. 9 http://www.lonniebest.com/FormatCSS/
  10. 10 http://www.lonniebest.com/FormatCSS/
  11. 11 http://cdburnerxp.se/cssparse/css_optimiser.php?lang=de
  12. 12 http://www.cleancss.com/?lang=de
  13. 13 http://cdburnerxp.se/cssparse/css_optimiser.php?lang=de
  14. 14 http://softwaremaniacs.org/soft/highlight/en/
  15. 15 http://google-code-prettify.googlecode.com/svn/trunk/README.html
  16. 16 http://softwaremaniacs.org/soft/highlight/en/
  17. 17 http://google-code-prettify.googlecode.com/svn/trunk/README.html
  18. 18 http://pluszone.net/blog/projects/beautifierPlus/index.php
  19. 19 http://pluszone.net/blog/projects/beautifierPlus/index.php
  20. 20 http://formatter.gerbenvv.nl/version3/index.php?lang=en
  21. 21 http://formatter.gerbenvv.nl/version3/index.php?lang=en
  22. 22 http://beautifyphp.sourceforge.net/docs/
  23. 23 http://elfz.laacz.lv/beautify/?
  24. 24 http://couponmeister.com/beautify.aspx
  25. 25 http://tidy.sourceforge.net/
  26. 26 http://perso.wanadoo.fr/ablavier/TidyGUI/
  27. 27 http://sourceforge.net/projects/tidy
  28. 28 http://www.w3.org/People/Raggett/tidy/
  29. 29 http://www.highdots.com/html-code-export/
  30. 30 http://csstidy.sourceforge.net/
  31. 31 http://perltidy.sourceforge.net/
  32. 32 http://users.skynet.be/mgueury/mozilla/index.html
  33. 33 http://tidy.sourceforge.net/
  34. 34 http://www.textrush.com/
  35. 35 http://www.textrush.com/
  36. 36 http://www.polystyle.com/
  37. 37 http://www.waterproof.fr/products/phpCodeBeautifier/
  38. 38 http://www.digital-mines.com/htb/

↑ Back to top Tweet itShare on Facebook

Sven is the co-founder and former CEO of Smashing Magazine. He's now writing at his Conterest Blog, where he focuses on blogs, content strategy and publishing — all in German.

  1. 1

    John Robo, the best COBOL formatter I could find is unlimited shareware; search for Cobol Beautifier…

  2. 52

    very interesting article . Thank you

  3. 103

    Nice list… I may be wrong, but I think you forgot one for Javascript minimizing:
    JS Minifier
    Have used it for several months now, very pleasing results.


  4. 154

    we just started a blog covering this topic in general. so if you’re interested you may check out . there will be following articles concerning this topic pretty soon.

  5. 205

    For C# and/or t-sql (sql server) code try: http://www.softfrontiers.com/Downloads/ReIndenter.shtml
    It’s fast and free. It only changes indentation levels for code blocks and will add comments to code block ends where possible and necessary.

  6. 256

    I’m surprised you didn’t mention a couple of Java code beautifiers: Jalopy and Jacobe.
    Jalopy is available at

    and Jacobe at

  7. 307

    Thanks for posting this, and also for posting all of the source code, very helpful examples. :-)

  8. 358

    Thanks for the list.
    I also found online javascript formatter which is pretty simple to use at http://www.formatjavascript.com/

  9. 409

    With new version of dbForge SQL Complete you can also format a code.

    Formatting SQL Code

  10. 460

    HTML Beautifier .Net is advanced and flexible solution for .Net applications to filter, clean up and modify HTML, XHTML, ASPX, XML documents at server-side. The component can be easily integrated into any type of .Net application, either ASP.Net websites, Console or Windows Forms applications, to replace, remove or change any HTML/ASPX/XML tags, attributes, CSS, scripts, comments, forms, everything what you want to change in HTML document on fly.

  11. 511

    Antoine Martin

    May 13, 2011 4:15 am


    Does an extension exist on notepad++ to beautify php,html,js ?


  12. 562
  13. 613

    SourceFormatX is fake don’t use it i have purchased version it isn’t complete software i have request money refund but they don’t back my money

  14. 664

    I am missing Jindent a Source Code Formatter for Java and C/C++.
    Very nice IDE integrations for Eclipse, Netbeans, IntelliJ IDEA, JDevelopers…


  15. 715

    In case you are looking for HTML output beautifier (as opposed to input, IDE), I’ve written library that’s sole purpose is to handle HTML indenting, https://github.com/gajus/dindent. Contrary to PHP Tidy or HTML Purifier, Dindent is used exclusively for code indenting and is dedicated for development environment, as opposed to production.

  16. 766

    COBOL ?
    What’s that ! :-) Sounds hard !

  17. 817

    I think Dreamweaver already has a built in function for cleaning up code.
    Commands > Clean up Source Formatting

  18. 868

    Can you tell us why Vim is better? Can you give us some examples of what it can do that other editors cannot?


↑ Back to top