LESS to Stylus Converter
Move a LESS stylesheet to Stylus. Variables are assigned with = the way Stylus expects, parametric mixins carry over, and braces give way to indentation.
LESS Input
Stylus Output
What Is LESS to Stylus Conversion?
LESS and Stylus are both CSS preprocessors that add variables, nesting and mixins on top of plain CSS, but the syntax differs a lot. LESS uses @variable: value; with the braces and semicolons you know from CSS. Stylus is whitespace-significant: indentation defines structure instead of {} and ;, and a variable is assigned with an equals sign, as in $accent = #e74c3c. Write $accent: #e74c3c at the top level and Stylus treats it as a property, not a variable, which is the mistake a quick find-and-replace makes.
This tool handles the mechanical parts of that migration. It rewrites @vars as $vars assigned with =, turns .rounded(@r: 4px) { } into a Stylus mixin rounded($r = 4px) and .rounded(6px); into rounded(6px), converts @{name} interpolation to {$name}, strips braces and semicolons, and re-indents nested rules. Comments are dropped. Mixins with when guards and LESS-only built-ins still need a manual pass.
How to Use
Paste your LESS code
Paste the contents of a .less stylesheet on the left, or use Upload to read the file straight from disk. No file handy? Sample fills the editor with a small .alert stylesheet that uses variables, nesting and a &:hover rule.
Conversion happens automatically
As soon as you type or paste, the converter runs. @name: value; becomes $name = value, curly braces are removed, semicolons are dropped, and nesting is expressed through indentation, as in real Stylus syntax.
Copy or download the result
Take the converted code with Copy, or let Download hand you a ready-made .styl file. From there you can drop it straight into a project that uses a Stylus build pipeline.
Example
Here's a real LESS snippet converted to Stylus. Paste your own code above and the output updates as you type.
LESS alert component → Stylus
LESS input
Stylus output
Click Sample above to load this example directly into the editor and try it yourself.
When This Tool Helps Most
If you've inherited a LESS codebase and your new project uses Stylus, manually rewriting every rule is tedious and error-prone. This converter takes care of the syntax differences in one shot: variable prefix changes, brace removal, semicolon stripping. You're left with structurally correct Stylus that you can then fine-tune.
It's also useful if you're just learning Stylus and want to see how familiar LESS patterns translate. Side-by-side comparison makes it easy to understand the differences between CSS preprocessors without having to read the full docs for each one.
Frequently Asked Questions
How different do LESS and Stylus actually look?
LESS looks a lot like regular CSS: it uses @variable: value;, curly braces for nesting, and semicolons at the end of each declaration. Stylus is whitespace-significant: indentation defines structure, braces and semicolons are optional (and usually omitted), and variables use a $ prefix. The same styles can be written in either, but Stylus tends to be more concise.
Why does this converter change @variables to $variables?
In LESS, variables are prefixed with @. In Stylus a variable can be a bare name or start with $, and it is assigned with =, so @accent: red; becomes $accent = red. The $ convention is more common and avoids confusion with CSS at-rules like @media and @keyframes, which need to stay untouched. This converter renames @yourVar to $yourVar while leaving real at-rules alone.
Will mixins and functions convert correctly?
Parametric mixins do. .rounded(@r: 4px; @c: #ccc) { } becomes the Stylus mixin rounded($r = 4px, $c = #ccc), a call like .rounded(6px); becomes rounded(6px), and a bare .bordered; becomes @extend .bordered. LESS color functions such as lighten(), darken() and mix() exist in Stylus under the same names. Guards with when and namespaced calls are left as LESS.
Does nesting work the same in both preprocessors?
Yes. Both LESS and Stylus support nested selectors and the & parent reference. The difference is purely syntactic: LESS uses braces to delimit blocks, while Stylus uses indentation. This converter reformats the nesting structure automatically.
Can I use this tool to migrate a full LESS project to Stylus?
It's a solid starting point. The converter handles the structural syntax: variable renaming, brace and semicolon removal, indentation-based nesting. For a large project, run each file through the converter, then do a quick review pass for anything that used LESS-specific features (like when guards or #namespace > .mixin lookups) that don't have a direct Stylus equivalent. The Stylus docs are a handy reference during that review.
Are @media queries preserved during conversion?
Yes. The converter explicitly skips renaming CSS at-rules like @media, @keyframes, @import, and @font-face. Only LESS user-defined variables (things like @primaryColor) are renamed to use the $ prefix.
Related Tools
Explore more CSS preprocessing tools: convert between LESS, SCSS, Sass, Stylus, and plain CSS, or format and minify your stylesheets.