Minify your JavaScript

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

Written and hosted by Andrew Chilton (@andychilton).


    // setup the URL, the JavaScript and the form data
    $url = '';
    $js = file_get_contents('./public/s/js/ready.js');
    $data = array(
        'input' => $js,

    // init the request, set some info, send it and finally close it
    $ch = curl_init($url);

    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    $minified = curl_exec($ch);


    // output the $minified
    echo $minified;

Also, Toni Almeida has made a PHP library to easily talk to JavaScript Minifier :

Language Examples

Click on the language of your choice:

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

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.