Home/Dev Tools/Less Formatter

Less Formatter

Format

Format and beautify Less CSS files with proper indentation and property sorting.

Indent
Options
Input
Loading editor…
Output
Loading editor…
✨ AI Code Explanation
Mode

What Is Less CSS?

Less (Leaner Style Sheets) is a CSS preprocessor that adds variables, nesting, mixins, and functions to plain CSS. Less files (.less) compile to standard CSS that browsers can render. Created in 2009, Less powered Bootstrap 3 and 4 and remains popular in the ant-design and React Admin ecosystems. Compared to SCSS, Less uses @variable instead of $variable and compiles via JavaScript rather than Dart Sass.

Less Formatter Online — What This Tool Does

This free Less formatter beautifies .less files entirely in your browser using Prettier's Less parser. Fixes inconsistent indentation, aligns nesting, spaces declarations correctly, and optionally sorts properties alphabetically. Output is production-ready Less that any Less compiler can process.

How to Format Less Online

  • Paste Less code into the Input pane, or click Upload to load a .less file.
  • Choose an indent size (2, 4, or 6 spaces).
  • Toggle Sort props to alphabetise declarations within each rule.
  • Toggle No comments to strip // and /* */ comments.
  • Click Beautify. The formatted Less appears in the output pane.
  • Click Copy or Download to save as formatted.less.

Less vs SCSS — Which to Pick?

  • Less uses @variable, compiles in JavaScript, integrates with Webpack out of the box, has simpler mixin syntax (.mixin();). Used by Bootstrap 3/4, ant-design.
  • SCSS uses $variable, compiles via Dart Sass, has more powerful features (placeholders, advanced control flow, modules), broader adoption. Used by Bootstrap 5+, Bulma.
  • Switch only if needed — converting a large Less codebase to SCSS is non-trivial. The features are 90% equivalent; the syntactic differences are the bigger lift.

Less Features Preserved by the Formatter

  • @variables — formatted but never evaluated.
  • .mixin(); — mixin call sites stay structured.
  • Selector nesting and & parent references.
  • @import statements for splitting files.
  • Operations (math, colour functions) — formatted as written.
  • @media queries and nested at-rules.

Tips & Tricks

  • 2-space indent matches Bootstrap 3 and ant-design conventions — pick this for consistency with the larger Less ecosystem.
  • Sort props alphabetically when refactoring legacy Less — easier to spot duplicates and conflicting declarations.
  • Format before review — Less codebases tend to accumulate inconsistent style; formatting before PRs keeps diffs focused on logic.
  • Pair with the Less Minifier — format the source, minify the build.

Related Tools

Is My Code Sent to a Server?

No. Less formatting runs entirely in your browser using Prettier. Your stylesheet — including any design system tokens or proprietary brand variables — never leaves your machine.