Esta página aún no está traducida al español, así que la mostramos en inglés.

CSS Formatter & Beautifier

Turn a minified stylesheet into readable CSS with one property per line and properly nested @media blocks. Works with CSS, SCSS and Less syntax.

Actualizado el
 
Formatted CSS
 

Tus datos nunca salen de tu ordenador. Todo se procesa localmente en tu navegador.

Cómo usar: CSS Formatter

  1. Paste your stylesheet into Input CSS, drop a .css file onto it, or click Sample.
  2. Pick the indentation and whether you want a blank line between rules and each selector of a group on its own line.
  3. Copy or download the formatted CSS. Switch to Minify when you need the compact version again.

What does a CSS formatter do?

A CSS formatter takes stylesheet code in any shape — minified onto one line, inconsistently indented, or copied from browser DevTools — and rewrites it with a predictable layout: the selector, an opening brace, one property: value; declaration per line, and the closing brace on its own line. Rules inside @media, @supports and @container blocks get an extra level of indentation so the structure is obvious.

Formatting is the first step when you need to debug a third-party theme, review CSS in a pull request or learn from another site’s styles. The formatter is powered by js-beautify and runs entirely in your browser.

Before and after

.btn,.btn-primary{display:inline-flex;padding:.625rem 1rem;color:#fff}@media (max-width:640px){.btn{width:100%}}

becomes

.btn,
.btn-primary {
  display: inline-flex;
  padding: .625rem 1rem;
  color: #fff
}

@media (max-width:640px) {
  .btn {
    width: 100%
  }
}

Note that the formatter does not add or remove semicolons, reorder properties or change values — it only changes whitespace, so the result behaves exactly like the input.

SCSS, Less and modern CSS

Nested rules, & parent selectors, variables ($brand, @brand), mixins and native CSS nesting are all indented correctly. Custom properties (--brand: #4f46e5), clamp(), :is()/:where() and cascade layers (@layer) pass through untouched.

Style conventions worth adopting

  • Two-space indentation is the de-facto standard in most CSS style guides and the Prettier default.
  • One selector per line in grouped selectors makes diffs smaller when you add or remove a selector.
  • A blank line between rules improves scanning in long files.
  • Keep formatting automatic: run Prettier or Stylelint in your editor and CI so formatting never shows up in code review.

Shipping to production? Use the CSS Minifier to see exactly how many bytes you save, or tick Minify above. To convert pixel values while you are at it, try the PX to REM converter.

También se busca como: css beautifier, css prettifier, format css, pretty print css, unminify css, css indent, scss formatter, less formatter.

Herramientas que combinan con: CSS Formatter

  • HTML Formatter — Paste minified or messy markup and get clean, consistently indented HTML — including embedded <style> and <script> blocks.
  • JavaScript Formatter — Unminify and pretty-print JavaScript, JSON or JSX with your preferred indentation and brace style — or strip whitespace and comments with a verified minifier.
  • Calculadora de abrazaderas — Introduce un tamaño mínimo y máximo y el rango de la ventana de visualización: obtendrás un valor fácil de ajustar con el zoom clamp() con una explicación de los cálculos, una vista previa en directo y una escala completa y fluida de tipo o espacio.
  • Color Converter — Paste any CSS color — HEX, rgb(), hsl(), hwb(), oklch() or a name like tomato — and get every other format instantly, plus a ready-to-use 50–950 palette.

Preguntas frecuentes

Does formatting CSS change how it works?
No. Only whitespace and line breaks change; selectors, properties and values stay exactly the same, so the browser applies identical styles.
Can I unminify a .min.css file?
Yes — paste it in or drop the file onto the input. Comments that were removed during minification can’t be restored, but the structure becomes fully readable.
Does it support SCSS and Less?
Yes, nesting, variables, mixins and & selectors are indented correctly. The tool formats the syntax but doesn’t compile SCSS or Less to CSS.
Is my CSS sent to a server?
No. Everything runs locally in your browser, so private or unreleased stylesheets never leave your device.
Should I use tabs or spaces for CSS?
Either works; consistency matters more. Two spaces is the most common choice in style guides and the default in Prettier, while tabs let each developer choose their own visual width.
¿Puedo instalar CSS Formatter como aplicación web y utilizarla sin conexión?
Sí. CSS Formatter es una aplicación web instalable (PWA): se instala desde el navegador, no se descarga desde una tienda de aplicaciones. Haz clic en «Instalar aplicación» en la parte superior de esta página en Chrome o Edge (Windows, macOS, Linux, ChromeOS) o, en Android, utiliza «Compartir» → «Añadir a la pantalla de inicio» en iPhone y iPad, o «Archivo» → «Añadir al Dock» en Safari 17+ en un Mac. A continuación, se abrirá en su propia ventana con su propio icono y, como se ejecuta íntegramente en tu navegador, seguirá funcionando sin conexión. Firefox en el ordenador de sobremesa no permite instalar aplicaciones web. Cómo funciona la instalación.

Herramientas relacionadas