JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat.


Minification, also known as minimization, is the process of removing all unnecessary characters from JavaScript source code without altering its functionality. This includes the removal of whitespace, comments, and semicolons, along with the use of shorter variable names and functions. Minification of JavaScript code results in compact file size.


For example, here is a block of code before and after minification:


Before minification: lines of code

function sayHi (name){
console.log("Hi" + name +",nice to meet you.")



After minification: A single line of code

function sayHi(o){console.log("Hi"+o+",nice to meet you.")}sayHi("Sam");


Minification speeds up webpage loading, thereby improving website experience, making both visitors and search engines happy.


How to minify JavaScript?

There a lot of online tools that will allow this. The most robust are JavaScript libraries like:

  • Webpack
  • Uglify which usually comes with Gulp
  • Online tools that also allow this for smaller projects


Was this answer helpful? 0 Users Found This Useful (0 Votes)