We've been hosted on Digital Ocean since 2013 and highly recommend it for your hosting too. Try it now!

JavaScript Minifier

Online JavaScript Minifier/Compressor. Free! Provides an API. Simple Quick and Fast.

Written and hosted by Andrew Chilton (@andychilton) since 2012.


Thanks toJeremy Cron for contributing this example.

require "rest_client"

task :minify do
  js_file = "public/scripts/ready.js"
  js_min_file = "public/scripts/ready.min.js"
  response = RestClient.post "https://javascript-minifier.com/raw", {:input => File.open(js_file).read}
  File.open(js_min_file, "w").write(response)

Many people have sent language examples over the years, but we want more! We'd love to add more examples in your favourite programming language, so please send them our way. Email andychilton at that gmail place in the sky, tweet me @andychilton, or open an issue or PR on webdev.sh/javascript-minifier.com.

Click on the language of your choice to see an example: