Minify
This page provides six browser-based minification tools accessible from the left sidebar. Every tool runs entirely in your browser with no data uploaded, no account required, and no server contact. Select a format from the sidebar, paste your code or upload a file, and the minified output appears instantly in the right panel. A visual size comparison shows original and minified sizes side by side. Drag and drop file upload is supported across all tools.
Minify CSS
Removes comments, collapses whitespace, strips last semicolons, and shortens hex colors. Four configurable options let you control exactly which optimizations apply.
Minify JS
Removes block and line comments, blank lines, and unnecessary whitespace from JavaScript code for quick compression.
Minify HTML
Strips HTML comments, collapses inter-tag whitespace, and reduces markup to the smallest valid output while preserving inline scripts and styles.
Minify JSON
Parses and re-serializes JSON with zero formatting. Validates structure and shows clear error messages for invalid input.
Minify SVG
Removes XML declarations, comments, and unnecessary whitespace from SVG while preserving all paths, shapes, and visual elements.
Minify XML
Strips comments and inter-tag whitespace from XML documents to produce the smallest valid output for configs, feeds, and payloads.
Free Minify Tool for CSS with Configurable Options
The free minify tool on this page starts with CSS as the default format and provides four independent optimization options. Remove Comments strips all block comments delimited by /* and */. Collapse Whitespace removes all spaces around braces, colons, semicolons, and commas, then reduces remaining whitespace runs to nothing. Strip Last Semicolon removes the trailing semicolon before each closing brace since CSS parsers do not require it. Shorten Colors scans for 6-digit hex color values where each pair of digits is identical, like #aabbcc, and replaces them with 3-digit equivalents like #abc. Each option works independently so you can customize exactly which transformations apply to your stylesheet.
Visual Size Comparison
A dual-bar comparison meter appears below the options bar whenever code is being minified. It shows two horizontal bars: the top bar represents the original file size at full width, and the bottom bar scales proportionally to show the minified size. The percentage reduction and exact bytes saved are displayed alongside, with a line count comparison showing how many lines were reduced. This visual feedback makes it immediately clear how effective the minification is and helps you decide whether additional optimization options would provide meaningful savings.
How CSS Minification Works
The CSS minifier processes your code in four sequential passes based on enabled options. Comment removal scans for block comment boundaries and strips them. Whitespace collapsing removes all spaces around syntax characters and reduces remaining runs. Last-semicolon removal targets the pattern of a semicolon immediately followed by a closing brace. Color shortening uses a regular expression to identify 6-digit hex values with paired digits and replaces them with 3-digit equivalents. The result is the smallest valid CSS that browsers interpret identically to the original.
Online Minify for JavaScript, HTML, and JSON
Beyond CSS, this page covers all the common file formats used in web development. The online minify tool handles JavaScript, HTML, and JSON with dedicated processors optimized for each format. Select any format from the sidebar, paste code or upload a file, and the minified output appears instantly. Each tool shows the same dual-bar size comparison with percentage reduction and line count changes.
JavaScript Minification
The JS minifier handles block comments (/* */), single-line comments (//), multi-line whitespace, and spaces around operators and syntax characters. It collapses the result into the most compact valid JavaScript possible. This is a lightweight minifier designed for quick tasks. For production builds that need variable renaming, dead code elimination, and tree shaking, use a bundler with Terser or esbuild as the optimizer.
HTML Minification
The HTML minifier removes all comment nodes, collapses whitespace between closing and opening tag brackets to nothing, and reduces internal whitespace runs to single spaces. Inline style and script blocks are preserved exactly as written. The result is valid HTML that browsers render identically but with significantly fewer bytes to transfer. This is effective for template files, email HTML, static pages, and server-rendered markup.
JSON Minification
The JSON minifier fully parses the input using the built-in JSON parser, validates the structure, and re-serializes it with zero whitespace. The output is a single-line string with no indentation, spaces, or line breaks. If the input is invalid JSON, a clear error message identifies the exact problem and its location. This is useful for compacting API responses, configuration files, package manifests, and data export files.
SVG and XML Minification
SVG files exported from design tools often contain XML declarations, editor metadata, comments, and excessive whitespace that can substantially increase file size. The Minify SVG tool strips XML processing instructions, removes all comments, collapses inter-tag whitespace, and cleans up redundant spacing inside tags. All paths, shapes, gradients, filters, and visual attributes are preserved so the graphic renders identically after minification. Minify XML applies similar transformations to any XML document, making it useful for configuration files, RSS feeds, SOAP payloads, sitemaps, and data interchange formats.
When to Use Each Minifier
Use CSS minification before deploying stylesheets to production. Use JS minification for standalone utility scripts and snippets. Use HTML minification for templates, static pages, and email HTML. Use JSON minification for API responses, configs, and manifests. Use SVG minification when embedding graphics inline or serving them as image sources. Use XML minification for configuration files, data feeds, and API payloads where transfer size matters.
File Upload, Download, and Privacy
All six tools accept files via the Upload File button in the toolbar or by dragging and dropping a file directly onto the input panel. Supported extensions vary by tool: .css, .js, .html, .json, .svg, and .xml. After minification, the output can be copied to the clipboard with one click or downloaded with a descriptive filename (output.min.css, output.min.js, output.min.html, and so on). All processing runs entirely in your browser using JavaScript. No data is uploaded to any server, no account is required, and nothing is stored or logged.