Less Formatter
Format and beautify Less CSS files with proper indentation and property sorting.
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
.lessfile. - 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. @importstatements for splitting files.- Operations (math, colour functions) — formatted as written.
@mediaqueries 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
- Less Minifier — compress Less for production deployment.
- SCSS Formatter — format SCSS files (the more popular preprocessor).
- CSS Formatter — format plain CSS stylesheets.
- CSS Minifier — compress compiled CSS for production.
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.