LESS to CSS Converter
Convert LESS to CSS instantly in your browser. Real-time compilation with less.js, no Node.js required. Paste, edit, and download clean CSS.
About
LESS is a CSS preprocessor that extends standard CSS with variables (@color), mixins, nesting, and mathematical operations. Writing LESS without compiling it produces zero usable output. A missing semicolon inside a mixin guard or an incorrect variable scope can cascade into a completely broken stylesheet, silently dropping hundreds of rules. This tool runs the canonical less.js compiler directly in your browser. No Node.js runtime, no Ruby, no build pipeline. It parses your LESS source through the full AST pipeline and emits standards-compliant CSS. Note: @import statements referencing external files will not resolve in a browser context. Inline all dependencies before compiling.
Formulas
LESS compilation follows a deterministic pipeline. The source string is tokenized, parsed into an Abstract Syntax Tree, evaluated (resolving variables, mixins, and expressions), then serialized back to CSS text.
Variable resolution uses lazy evaluation. A variable @x defined at scope depth d is resolved by walking up the scope chain from the current block to the root. The last definition encountered in document order within the resolved scope wins. Mathematical operations preserve unit types: 10px + 5px = 15px. Incompatible units (e.g., px + em) produce a compilation error. Color functions operate in HSL or RGB space: darken(@c, @amount) subtracts @amount from the lightness channel L in HSL representation.
Reference Data
| LESS Feature | Syntax Example | CSS Output | Notes |
|---|---|---|---|
| Variables | @color: #4D926F; | Replaced inline | Scoped to block |
| Nesting | .parent { .child { } } | .parent .child { } | Max ~3 levels recommended |
| Mixins | .border-radius(@r) { ... } | Expanded at call site | Parametric supported |
| Mixin Guards | .mixin() when (@a > 10) | Conditional output | Boolean logic |
| Operations | @base × 2 | Computed value | Unit inference |
| Functions | darken(@color, 10%) | Hex/RGB value | ~75 built-in functions |
| Namespaces | #bundle() { .btn { } } | #bundle .btn { } | Organizational |
| Extend | :extend(.class) | Merged selectors | Reduces output size |
| Import | @import "file.less"; | Inlined content | Browser: inline only |
| String Interpolation | @{name} | Replaced value | In selectors & URLs |
| Escaping | ~"calc(100% - 10px)" | calc(100% - 10px) | Pass-through literal |
| Maps | #colors() { primary: blue; } | Accessed via #colors[primary] | LESS 3.5+ |
| Each Loop | each(@list, { .@{value} {} }) | Iterated rules | LESS 3.7+ |
| Detached Rulesets | @rules: { color: red; }; | Expanded at use | Like lambda blocks |
| Parent Selector | &:hover { } | .parent:hover { } | & = parent reference |
| Property Merging | transform+: rotate(15deg); | Comma-merged | Use + or +_ suffix |
| Default Variables | @var: val; (redefinable) | Last definition wins | Lazy evaluation |
| Scope | Block-level | N/A | Inner overrides outer |
| Comments | // line & /* block */ | /* block */ preserved | // stripped in output |
| Compression | compress: true | Minified output | Removes whitespace |