
Plain CSS gets repetitive as a site grows. The same brand colour appears in two hundred places, every button variant repeats the same block of declarations, and selectors for one component are spread across a long file. For years CSS had no variables, no nesting and no way to reuse a group of rules, so teams added a preprocessor: a language that compiles to CSS and fills those gaps. Less was one of the first and, for a long time, one of the most widely used.
This article explains what Less is, how it works, where you will still find it, how it relates to Sass and modern CSS, and when it is worth keeping.
What is Less?
Less, short for Leaner Style Sheets, is a CSS preprocessor: a stylesheet language that extends CSS with variables, mixins, nesting, operations and functions, and is compiled into ordinary CSS for browsers to use. Its syntax stays very close to CSS, and valid CSS is also valid Less, so an existing stylesheet can be renamed to .less and improved step by step.
Alexis Sellier created Less in 2009. He was inspired by Sass but wanted a leaner feature set and a syntax closer to plain CSS. Less was first written in Ruby and later ported to JavaScript, which is the implementation used today (Less.js). In May 2012 Sellier handed development over to a core team of contributors, and the project is released under the Apache 2.0 licence. It is still maintained, with releases in the 4.x line.
Less became widely known through Bootstrap, whose first three major versions were written in Less. When Bootstrap 4 moved to Sass in 2015, much of the ecosystem followed, but a large number of themes, admin templates and enterprise front ends built in that era still compile Less today.
How Less works
A compile step. Browsers cannot read .less files. The Less compiler, which runs on Node.js, turns them into a .css file during the build, usually through the lessc command line tool or a bundler plugin. Less can also compile in the browser with a script tag, but the project recommends that only for development.
Variables. Values are stored once and reused: @brand-primary: #1c4ed8; and then color: @brand-primary;. Changing a theme means changing a handful of variables instead of searching the whole codebase.
Nesting. Rules can be written inside their parent selector, and & refers to the parent, so a component's states and children sit together: .button { &:hover { … } .icon { … } }.
Mixins. Any class can be reused inside another rule, and parametric mixins accept arguments like functions. Guards add conditions, so a mixin can output different CSS depending on its inputs.
Operations and functions. Less can do arithmetic on numbers, colours and units, and ships built-in functions for colours, maths, strings and types, such as lightening or darkening a colour from a base value.
Imports. Stylesheets can be split into partial files and combined with @import at compile time, which keeps large style systems organised.
Key features
- CSS-compatible syntax: any valid CSS file is already valid Less.
- Variables for colours, spacing, fonts and breakpoints.
- Nesting with the
&parent selector. - Mixins with parameters and guards for reusable blocks of rules.
- Operations and built-in functions for colour and number manipulation.
- Imports for splitting styles into modules.
- JavaScript implementation that fits into Node.js build tools.
Where Less is used
- Bootstrap 3 and earlier projects, including many themes and admin templates built on them.
- Enterprise front ends from the 2010s whose design systems were written in Less.
- Projects built on Ant Design 4 or earlier, which used Less for theming until Ant Design 5 replaced it with CSS-in-JS in 2022.
- Large legacy stylesheets that need to be maintained without rewriting every rule.
When to choose Less, and when not to
Keep or choose Less when:
- The project, its UI framework or its theme is already written in Less. Rewriting working styles in another language rarely pays off on its own.
- You need to change a theme built on Less variables, such as an older Bootstrap or Ant Design setup.
- The team is modernising in stages and wants the styles to keep working while the rest of the front end changes.
Look elsewhere when:
- You are starting a new project. Modern CSS now covers much of what Less was used for: custom properties provide variables that can even change at runtime, and native CSS nesting has worked in all major browsers since 2023.
- You want the largest preprocessor ecosystem. Sass has had more momentum since the mid-2010s, which is why Bootstrap moved to it.
- The team uses a utility-first approach such as Tailwind CSS, or component-scoped styling, where a preprocessor adds little.
- You want to avoid a separate stylesheet compile step altogether.
Less and its alternatives
| Option | Type | Strength | Best fit |
|---|---|---|---|
| Less | CSS preprocessor, JavaScript-based | CSS-like syntax, simple to adopt | Existing Less codebases, Bootstrap 3 era themes |
| Sass (SCSS) | CSS preprocessor | Larger ecosystem, richer language features | Projects that still want a preprocessor |
| Modern CSS | Browser native | Custom properties, nesting, no build step | New projects |
| PostCSS | CSS transformation tool | Plugin pipeline, future CSS syntax | Build pipelines and autoprefixing |
| Tailwind CSS | Utility-first framework | Styles composed in markup, design tokens | Component-based web apps |
Less and Sass solve the same problem with similar ideas, and the differences are mostly ecosystem and syntax details; our Sass article covers that comparison in detail. The bigger change is that CSS3 and its successors absorbed the most-used preprocessor features, so for new work the question is often whether a preprocessor is needed at all.
How we use Less at Internative
We use Less in projects that need to stay compatible with existing styling architectures or older UI frameworks. It lets us maintain and evolve large CSS systems with minimal disruption, so a product's styles keep working while the rest of its front end is modernised.
If you are maintaining a product whose front end has grown around older frameworks and stylesheets, our product modernization team can help you decide what to keep, what to migrate and in which order.
Frequently asked questions
What is the difference between Less and Sass?
Both are CSS preprocessors with variables, nesting, mixins and functions. Less uses @ for variables and has a syntax very close to CSS; Sass, in its SCSS syntax, uses $ for variables and offers a richer set of language features with a larger ecosystem. For new projects that still want a preprocessor, Sass is the more common choice; Less is usually kept where a codebase already uses it.
Is Less still used?
Yes. Less is still maintained and releases continue in the 4.x line, and a large number of existing projects, especially those built on Bootstrap 3 or older Ant Design versions, compile Less today. New projects choose it less often, because modern CSS and Sass cover most of the same needs.
Do I still need a CSS preprocessor?
Often not. CSS custom properties give you variables, and native nesting works in all major browsers. Preprocessors still help with mixins, loops, compile-time functions and splitting files, and they remain the practical choice for codebases already written in them.
What is a .less file?
A .less file is a stylesheet written in the Less language. It looks like CSS but can contain variables, nested rules and mixins. It is compiled into a normal .css file before the browser loads it.
Can browsers read Less directly?
No. Browsers only understand CSS. Less files are compiled to CSS during the build, usually with the lessc command or a bundler plugin. Less.js can compile in the browser at runtime, but that approach is meant for development, not production.
Keep reading
The articles that follow this one.



