1001Ferramentas
🔄Converters

CSS to Stylus Converter

Convert plain CSS into the concise Stylus syntax, without braces or semicolons. Paste your CSS and copy the Stylus to modernize your project styling.

Suporta regras planas (sem aninhamento).

Em Stylus você pode omitir os caracteres opcionais. Por exemplo:

/* CSS */\n.h1 { font-size: 32px; color: #333; }\n\n/* Stylus */\n.h1\n  font-size 32px\n  color #333

From CSS to the leaner Stylus syntax

Stylus lets you drop braces, colons and semicolons, which feels odd at first if you came from CSS. Seeing the same rule in both shapes is the fastest way to build the habit, and it saves time when a snippet arrives as CSS while your project is all .styl files. Paste the CSS and the Stylus version shows up below, two spaces per declaration.

The parser works on flat rules: for each block, the selector becomes a line of its own and the declarations follow indented, with property and value separated by nothing but a space. So color: #333; turns into color #333. Since Stylus accepts both shapes, the result compiles the same whether you keep this output or put the punctuation back to match house style.

One catch: a block inside a block does not survive. Send in a media query and the inner rules convert while the @media line evaporates, so convert those pieces separately and reinsert the wrapper with the content indented beneath it. A /* */ comment attaches itself to the following selector. The converter also does not nest selectors or extract variables, which is most of the point of Stylus, so that work stays yours. Copy and clear included, all in the browser.

Frequently asked questions

Do I really have to remove the colons?
No. Stylus reads color #333 and color: #333 the same way. The output here uses the shorter form; put the punctuation back if your team prefers it.
What happens to media queries?
The declarations inside get converted, but the @media line is not in the output. Put it back by hand and indent the block underneath it.
Does it create variables and nesting?
No. It is a format change, one rule in and one rule out. Pulling colors into variables and nesting selectors is still a manual decision.

Related Tools