LESS to CSS Compiler
CV-45Paste LESS and get plain CSS back. The page runs the LESS compiler (less.js) in your browser, so variables, mixins, guards and operations are resolved the same way a build step would resolve them.
Runs in your browser. Nothing is uploaded.
LESS code
CSS code
How to use it
- Paste your LESS into the input box, or open a .less file.
- Pick Expanded for readable CSS or Compressed for one line.
- Press Compile LESS to CSS. The CSS appears in the output box.
- Copy it or download it as a .css file.
What gets compiled
Variables, nested rules, mixins with parameters, guards, operations such as @gap * 2, color functions and &:extend are all resolved by less.js, so what you see is what a LESS build would emit. Math is always evaluated, even outside parentheses. Inline JavaScript is switched off. Comments written with // are dropped by LESS; /* */ comments stay in Expanded output.
Why @import of another file is refused
The page reads only the text in the box and never fetches anything, so it cannot open a second .less file. A plain @import of a local name stops with an error instead of silently doing nothing. Paste the imported code above your own, or keep imports that point to a .css file or a url(), which pass through to the CSS unchanged.
Using the output
The CSS is exactly the compiler result for this one file, with no autoprefixing and no minification beyond the Compressed option. If a value looks different from what you expected, check the operators first: LESS divides and multiplies units. Go the other way with the SCSS or CSS converters if you are moving off LESS.
Error messages and what to do
| Message | What it means | Fix |
|---|---|---|
Line 2, column 4: variable @x is undefined | The code uses a variable that no @x: value; line defines. | Define the variable above its first use or fix the name. |
Line 1, column 9: Unrecognised input. Possibly missing something | The compiler could not read the code at that position. | Look for a missing ; } or ) near the column. |
@import of another file is not supported here: this tool compiles only the text you paste and fetches nothing. Paste the imported code into the input instead. | A local @import would need the page to load another file. | Paste the imported code into the box. |
Questions people ask
How do I compile LESS to CSS online?
Paste the LESS into the input box and press Compile LESS to CSS. The result is plain CSS with every variable, mixin and operation worked out. Choose Compressed if you want it on one line. It runs in your browser with the same compiler engine LESS projects use.
Does it support LESS mixins and variables?
Yes. Mixins with parameters, default values, guards, nested rules, @variables, interpolation such as @{name} and operations are handled by less.js. Features that need a second file, such as @import of a local .less file, are not available because the page loads nothing.
Why does my LESS division give a different number?
This page always evaluates math, so 10px / 2 becomes 5px even without parentheses, as in LESS 3 and earlier. LESS 4 projects often default to parentheses-only math, so output can differ if your build uses that setting.
Can it compile LESS with @import statements?
Not for local files. The page never fetches or reads other files, so those imports stop with an error that tells you to paste the code in. Imports of .css files and url() imports are passed through as written.
Are LESS comments kept in the CSS?
Block comments (/* ... */) stay in Expanded output. Line comments that start with // are removed by LESS itself, so they never reach the CSS. Compressed output drops block comments as well.
About this tool
Runs the LESS compiler (less.js) in your browser. Variables, mixins, operations, nesting, guards and built-in functions are resolved, so the output is plain CSS. Math is always evaluated, as in LESS 3. Inline JavaScript is off. @import of another file is refused with an error, because the page reads only what you paste and fetches nothing; paste the imported code into the box, or keep imports that point to a .css file or a url(), which pass through untouched. Comments that start with // are dropped by LESS.