Clean CSS is a tool that analyzes a webpage's HTML and CSS to determine which CSS rules are actually used. It removes unused styles and returns a clean, optimized stylesheet.
This project includes both a REST API and a web interface for cleaning CSS.
- 🚀 Detects CSS rules that are actually used
- 🧹 Removes unused CSS
- 🌐 REST API for programmatic usage
- 💻 Simple web interface
- ⚡ Fast and easy to use
You can use the API by sending a POST request containing your HTML and CSS.
Endpoint
https://clean-css-ol7w.onrender.com/api/v1/remove-unused-css
{
"html": "<p>Hello</p>",
"css": "p { color: red; }"
}import axios from "axios";
axios
.post("https://clean-css-ol7w.onrender.com/api/v1/remove-unused-css", {
html: "<p>Hello</p>",
css: "p { color: red; }",
})
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.error(error);
});You can also use Clean CSS directly from your browser:
Website
https://comfy-syrniki-a32afb.netlify.app/
Copy and paste your HTML and CSS into the provided editors.
The application analyzes your code and removes unused CSS rules.
Your cleaned stylesheet is displayed and ready to use.
Clean CSS executes only the JavaScript that runs during the initial page load.
JavaScript that modifies the DOM after user interactions (such as clicking buttons, opening menus, or loading content dynamically) is not executed. As a result, CSS used exclusively by those interactions may be considered unused.
This repository contains the source code for both:
- The REST API
- The web application
This project is licensed under the MIT License.



