js formatter

 

Beautifier options



This tool allows to beautify, minify and compress javascript code source.

Copy and paste, upload, drag and drop a JS file or directly type in the editor below.

There is no file size limit. Your files are not sent to our servers, they remain in your browser.

You can see the user guide to help you.


User guide

Fill the editor with your source code. You have several possibilities:

  • Copy and paste your JavaScript code
  • Drag and drop your JS file
  • Directly type in the editor
  • Browse your file ("Browse" button)
  • Load a JS file from a URL Browse your file ("Load from URL" button)

Choose the options (Below the editor).

Depending on your needs, click on:

  • "Beautify" to make your code more readable.
  • "Minify" to remove whitespace and other unnecessary characters.
  • "Compress" to compress and remove superfluous code and make your code compact.

Click on "Download" button in order to export JavaScript code.

Click on "Copy to clipboard" button in order to copy the code to clipboard.


Why beautify JavaScript ?

Beautifying is to reformat source code to improve readability for a human by following conventions. This consists of re-indenting, add line breaks, ...

we have to beautify code in different situations, like to make deobfuscate javascript code readable, also when we have to share code with other developers ("Good programmers write code that humans can understand" (Martin Fowler)), ...

This javascript beautifier takes ugly or obfuscated javascript and make it well-formatted code.

Why compress JavaScript ?

Compressing javascript source code improves download (decrease the JavaScript file size) and runtime performance, which can improve the SEO of websites (This is of course not the most important criterion ...).

Minification and compression do not correspond to the same processing:

  • Minification only removes white spaces (spaces, line breaks).
  • While compression also changes variable names (the longer variable names will be shortened), removes unnecessary code, compacts code etc. The resulting code is much less readable and understandable. It helps to obfuscator your source code.

This tool can be used occasionally. For a daily need, you have to script and directly use the libraries used by this page (or others ...).

It uses the Terser library (fork of uglify-es) and Prettier library.


Load JS From URL
You can report a bug or give feedback by adding a comment (below) or by clicking "Contact me" link (at the top right hand corner of the page).

Comments