What is a .less file?
Leaner Style Sheets · Code and data · Alexis Sellier · 2009
A .less file is Less source, a CSS preprocessor that adds variables, nesting and mixins to CSS. Like Sass, it compiles to ordinary CSS, and it can even run in the browser during development.
What is a .less file used for?
Less keeps a syntax very close to CSS and was popularised by Bootstrap's early versions. Its variables and mixins reduce repetition in large stylesheets.
A Less compiler produces standard CSS for production. The files are plain text and open in any editor.
How to open a .less file
The .less format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list. For a step-by-step walkthrough, see how to open a .less file.
Windows
- VS Code
- WebStorm
- any text editor
macOS
- VS Code
- WebStorm
- any text editor
Linux
- VS Code
- vim
- any text editor
How to convert a .less file
You can convert a .less file to css using a conversion tool or the export menu of an app that opens it.
.less file signature (magic bytes)
Programs recognise a .less file by the bytes at the start of the file, not by its name. These are the signatures for Less.
| Hex signature | Offset | Note |
|---|---|---|
| (no fixed signature) | 0 | plain text; no fixed magic bytes |
See the full magic-numbers reference for every format.
Frequently asked questions
What is a .less file?
A .less file is Less source, a CSS preprocessor that adds variables, nesting and mixins to CSS. Like Sass, it compiles to ordinary CSS, and it can even run in the browser during development.
What is the difference between Less and Sass?
Both are CSS preprocessors with variables and nesting. Sass is more powerful and popular today; Less is simpler and was tied to early Bootstrap.
How do I compile a .less file?
Use the lessc compiler (lessc styles.less styles.css), or let your build tool convert it to CSS automatically.
How do I open a .less file?
Any text editor shows it; VS Code adds Less highlighting. The syntax looks almost identical to CSS.
Related formats
Sources
Details on this page were checked against authoritative references: