← All Tools

CSS Formatter & Minifier

Copied!
Input: 0 charsOutput: 0 charsSaved: 0%
CSS Formatter & Minifier

A browser-based CSS tool that can beautify messy CSS with proper indentation, or minify it for production by stripping comments, whitespace, and unnecessary characters. Shows real-time size savings.

Why Use This CSS Formatter?

  • Format or Minify — two modes in one tool.
  • Comment stripping — minifier removes all CSS comments automatically.
  • Size stats — see input/output sizes and percentage saved at a glance.
  • No dependencies — runs entirely in your browser.

Key Features

  • Smart Indentation: Indentation tracks { / } nesting depth with 2-space tabs.
  • Property Splitting: Each declaration gets its own line after ;.
  • Comment Removal: Minifier strips all /* */ block comments.
  • Whitespace Compression: Collapses multi-spaces and removes spaces around {};:,.

How it Works

The formatter walks the CSS character by character: { increases indent and starts a new line, } decreases indent, and ; triggers a line break. The minifier uses regex to strip comments, collapse whitespace, and remove spaces around structural characters.

Try the CSS Formatter

Paste your CSS, click “Format” or “Minify”, then copy the result.

简体中文

CSS 格式化与压缩工具

美化或压缩 CSS 样式表,兼顾可读性和体积优化。

한국어

CSS 포매터 & 미니파이어

CSS 스타일시트를 보기 좋게 정리하거나, 배포용으로 용량을 줄여 압축합니다.

日本語

CSS フォーマット&圧縮ツール

CSS スタイルシートを整形したり、配布用に圧縮して軽量化します。