Minify your JavaScript

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

Written and hosted by Andrew Chilton (@andychilton).


Credits: Thanks to Cristian Tomatis for contributing this example.

import requests

url = ''
data = {'input': open('ready.js', 'rb').read()}
response =, data=data)

print response.text

Python - from the REPL

Credits: Thanks to Noam Yorav-Raphael for contributing this example.

>>> import requests
>>>'', data=dict(input='var a = 1;')).text
'var a=1;'

Python - a CLI tool

Credits: Thanks to Kyle S. for contributing this to the site.

# -*- coding: utf-8 -*-
import sys
import requests

    js_file = sys.argv[1]
    print("Missing input file")

# Grab the file contents
with open(js_file, 'r') as c:
    js =

# Pack it, ship it    
payload = {'input': js}
url = ''
print("Requesting mini-me of {}. . .".format(
r =, payload)

# Write out minified version
minified = js_file.rstrip('.js')+'.min.js'
with open(minified, 'w') as m:

print("Minification complete. See {}".format(

Language Examples

Click on the language of your choice:

wget Curl Node.js Python Java Ruby Perl PHP C# Rust Kotlin

More Languages

I'd love to add more examples in your favourite programming language, so feel free to send them my way. Email andychilton at that gmail place in the sky or tweet to me @andychilton.