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

CSS Minifier

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


    // setup the URL and read the CSS from a file
    $url = '';
    $css = file_get_contents('styles.css');

    // init the request, set various options, and send it
    $ch = curl_init();

    curl_setopt_array($ch, [
        CURLOPT_URL => $url,
        CURLOPT_POST => true,
        CURLOPT_HTTPHEADER => ["Content-Type: application/x-www-form-urlencoded"],
        CURLOPT_POSTFIELDS => http_build_query([ "input" => $css ])

    $minified = curl_exec($ch);

    // finally, close the request

    // output the $minified css
    echo $minified;

Thanks to Boudewijn van Breukelen for an updated version of the above code.

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

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