This site has been acquired by Toptal.com.
(Attention! API endpoint has changed)

JavaScript Minifier

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

Node.js

const querystring = require('querystring');
const https  = require('https');

const query = querystring.stringify({
  input : 'console.log( 1 );',
});

const req = https.request(
  {
    method   : 'POST',
    hostname : 'www.toptal.com',
    path     : '/developers/javascript-minifier/raw',
  },
  function(resp) {
    // if the statusCode isn't what we expect, get out of here
    if ( resp.statusCode !== 200 ) {
      console.log('StatusCode=' + resp.statusCode);
      return;
    }

    resp.pipe(process.stdout);
  }
);
req.on('error', function(err) {
  throw err;
});
req.setHeader('Content-Type', 'application/x-www-form-urlencoded');
req.setHeader('Content-Length', query.length);
req.end(query, 'utf8');

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