FormatterHQ

LESS to Stylus Converter

Convert LESS stylesheets to minimal Stylus syntax: evaluated values, nested selectors, and no braces, colons or semicolons.

Input LESS
Output STYLUS
Ready.

How to use the LESS to Stylus Converter

  1. Paste your LESS code into the Input editor, or use Sample, Upload file or Load URL.
  2. Press Convert. The LESS is compiled first, then written out as Stylus.
  3. Check the status bar for errors such as an undefined variable, which are reported with a line number.
  4. Use Copy or Download above the output panel to take the Stylus output with you.

What the LESS to Stylus converter does

This LESS to Stylus converter compiles your LESS with less.js, then prints the result in Stylus's most compact form: selectors on their own line, properties indented beneath them as property value, and nothing else. It is a quick way to move component styles from a LESS theme into a Stylus-based project, or simply to see how the same styles look with minimal syntax.

Example

@brand:#0f766e;@gap:8px;
.card{padding:(@gap*2);border:1px solid @brand;.title{font-weight:600}&:hover{border-color:darken(@brand,10%)}@media (min-width:768px){padding:(@gap*3)}}
.card
  padding 16px
  border 1px solid #0f766e
  .title
    font-weight 600
  &:hover
    border-color #094944

@media (min-width: 768px)
  .card
    padding 24px

All LESS expressions are evaluated. The nesting is rebuilt from the compiled selectors, so .card .title and .card:hover end up inside .card again.

LESS and Stylus side by side

FeatureLESSStylus
Variable@gap: 8px;gap = 8px or $gap = 8px
Mixin.pad(@x) { padding: @x; }pad(x) with an indented padding x
Mixin call.pad(4px);pad(4px), or pad 4px as a transparent mixin
Interpolation.@{name}.{name}
Color functiondarken(@c, 10%)darken(c, 10%)

The converter outputs values, not these constructs, so re-introduce variables and mixins by hand where they help. Stylus has a very similar set of built-in color functions, which makes this part of a migration straightforward.

Limitations

  • Imported LESS files are not available; paste their content first.
  • Multi-line comments are kept as /* */ blocks, and empty rules get a // empty line.
  • Compound selectors (.btn.active) remain separate rules.

How the Stylus nesting is rebuilt

After compiling, the converter looks at each CSS selector and splits it at the first combinator: .card .title becomes .title nested in .card, and .card:hover becomes &:hover. Rules that share a parent are merged into one block, in the order they first appear. When a parent has no declarations of its own and only one child, the two are collapsed back into a single selector such as nav a, so you never get empty wrapper blocks. Selector lists like h1, h2 and at-rules like @keyframes are kept as written. The result reads like hand-written Stylus while producing the same CSS as the original LESS.

Preview the Stylus result with the Stylus Compiler, or produce plain CSS directly with LESS to CSS. Everything runs locally in your browser.

A practical migration workflow

  1. Include shared variables. Paste the contents of your variables and mixins file above the component styles, since imports cannot be resolved here.
  2. Convert one component at a time. Small files are easier to review than a whole theme.
  3. Bring variables back. Look for colors and sizes that repeat in the output and replace them with Stylus variables such as $brand = #0f766e.
  4. Prove nothing changed. Compile the Stylus with the Stylus Compiler, compile the original with LESS to CSS, and compare the two stylesheets in the diff checker.

Escaped LESS strings such as ~"calc(100% - 10px)" are already resolved in the output, so they need no special handling in Stylus.

Frequently asked questions

Does the output keep my LESS variables?
No. The LESS is compiled first, so variables are replaced with their values. Add Stylus variables afterwards where values repeat.
Can Stylus read the output without colons?
Yes. Colons and semicolons are optional in Stylus, and the converter uses the minimal form.
What happens to LESS guards and conditions?
They are evaluated by less.js during compilation, so only the matching branch’s declarations appear in the Stylus output.
Are nested media queries preserved?
less.js bubbles them to the top level, and the Stylus output keeps them there with the selector inside.

Last updated September 26, 2026

Related tools