LESS Beautifier: Format and Beautify LESS Code Online
The LESS Beautifier formats LESS code with Prettier’s postcss-less parser, making stylesheets easier to read and review. Indentation, tab width, print width, quote style and line endings are configurable, and three presets cover the usual styles. Seven samples show the constructs the parser handles, from variables and guarded mixins to detached rulesets and maps. Paste or drop your LESS, choose your options, and copy the formatted result. If you paste SCSS instead — or indented .sass, which Prettier cannot parse — a warning names the tool to use. This tool beautifies LESS; to compile it into CSS, use the LESS to CSS Compiler.
The LESS Beautifier is an online LESS formatter that uses Prettier with the postcss-less parser. It makes LESS code easier to read and review without turning the stylesheet into CSS. If you need compiled CSS rather than formatted LESS, use the LESS to CSS Compiler.
To format code, paste or drop your LESS into the tool and choose how the output should look. Indentation offers 2 spaces, 4 spaces or tabs; Tab width sets how many columns a tab counts as when Prettier measures line width; Print width decides when a long value or selector list is wrapped; Single quotes rewrites quoted strings, including the quotes in url("a.png") and in @import paths; and Line endings, under Advanced, picks LF, CRLF, CR or "keep the first line ending". Three presets set every option at once — Prettier default, 4 spaces with single quotes, and tabs. Ctrl/Cmd+Enter formats, Ctrl/Cmd+S saves and Shift+Ctrl/Cmd+C copies. If the input does not parse cleanly, the reported line and code frame help you find the exact place to check.
Seven samples are included so you can see what the parser is known to handle: variables and nesting, mixins with when guards and !important, operations and colour functions such as darken(), escaped strings and @{interpolation}, @import (reference) with :extend, detached rulesets and maps, and comments alongside media queries. The postcss-less parser is permissive, so pasted SCSS usually formats without any error at all. Rather than leave you with quietly wrong output, the tool formats anyway and warns you that the code looks like SCSS, naming the tool that matches it. Indented .sass gets its own warning: Prettier has no .sass parser, so that syntax is reported as a syntax error and the hint explains why.
An optional check under Advanced, "Verify with the LESS compiler", compiles both your input and the formatted output with less.js and compares the CSS they produce, warning you when formatting changed it. It is off by default and loads the compiler only when you turn it on. Inputs the compiler cannot resolve — a missing @import file, plugins, JavaScript in backticks — are skipped in silence, as are files over 200 KB, and the formatted output is shown either way.
LESS is a stylesheet language that extends CSS with features such as variables and nesting. Formatting changes the presentation of the source code; compilation is a separate step that produces CSS. A LESS to CSS converter is useful when a project or workflow needs CSS output, while a LESS formatter helps make the original LESS source consistent and reviewable.
The LESS Beautifier runs entirely in your browser. Your input is processed on your device and is not sent to a server, and no signup is required. Once the page has loaded, the tool works offline, so you can format LESS without an active connection. This browser-based LESS formatter is useful for developers and DevOps engineers who maintain stylesheets, review changes, or need to tidy a code snippet.
Step 1: Paste or drop your LESS into the tool, or load one of the seven samples to see a construct the parser handles.
Step 2: Set indentation, tab width, print width, quote style and line endings, or choose one of the three presets — Prettier default, 4 spaces with single quotes, or tabs.
Step 3: Format with the button or Ctrl/Cmd+Enter. Live formatting keeps up until the file passes 300 KB, where the work moves off the main thread.
Step 4: Read any warning before the result: SCSS pasted into the LESS tool, indented .sass, or — with the optional compiler check switched on — a formatting change that alters the CSS this LESS compiles to.
Step 5: Copy the result and use it in your project, code review, or bug report. If the input does not parse, the reported line points at the problem. For CSS output, use the LESS to CSS Compiler.
Use case: Make an unreadable, machine-generated LESS file easier to review before committing it.
Use case: Check a LESS document you did not write against the formatting expectations for your project.
Use case: Produce consistently indented output so a diff highlights code changes instead of whitespace noise.
Use case: Match a project’s house style with one preset instead of setting indentation, quotes and line endings by hand.
Use case: Format a LESS snippet before adding it to a bug report or code review.
Use case: Check whether LESS input parses cleanly and use the reported line to locate a problem.
Use case: Paste SCSS or indented .sass by mistake and be told which tool or conversion you actually need.
Use case: Confirm that reformatting a LESS file did not change the CSS it compiles to, with the optional LESS compiler check.