CSS comment remover

Remove comments from
CSS code.

Remove /* CSS comments */ from stylesheets online. Preserves selectors, custom properties, and string values inside content.

Free, no signup Runs in your browser Instant, no upload Works on .css files

Before and after

Real-world CSS code on the left. The same code with every comment removed on the right.

css-input.css
/* ===== Reset ===== */
* { box-sizing: border-box; } /* universal */

/* Theme tokens */
:root {
  --color-bg: #fff;     /* light background */
  --color-fg: #000;     /* foreground */
  --radius: 8px;        /* base radius */
}

/* Layout */
.container {
  max-width: 1200px; /* wide */
  margin: 0 auto;
}

/* Buttons */
.button {
  background: var(--color-fg);
  color: var(--color-bg);
  border-radius: var(--radius);
}
css-output.csscleaned
* { box-sizing: border-box; }

:root {
  --color-bg: #fff;
  --color-fg: #000;
  --radius: 8px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.button {
  background: var(--color-fg);
  color: var(--color-bg);
  border-radius: var(--radius);
}
Why use it

Built for CSS specifically.

CSS files often include section banners, browser-compatibility notes, and licensing headers that aren't useful in production. Stripping them out reduces stylesheet size and removes implementation hints from view-source. Uncommenter handles every flavor of CSS comment in a single pass.

  • /* */ block comments removed
  • Selectors, declarations, and at-rules preserved
  • url("...") values containing /* preserved
  • CSS custom properties (--name: value) untouched
  • Auto-detected from .css files
How it works

Strip comments in 30 seconds.

  1. 1

    Open the tool

    Head to uncommenter.com/tool. Nothing to install. Nothing to sign up for.

  2. 2

    Paste your CSS code

    Drop your .css file in, or paste code into the editor. Auto-detection picks up CSS from the extension or file content.

  3. 3

    Click 'Remove Comments'

    The parser walks every character with a real state machine, strings, regex, and other context-sensitive parts are detected and left alone.

  4. 4

    Copy or download

    Grab the cleaned output. Your code never left your browser.

FAQ

CSS questions, answered.

What about SCSS or Sass?

+

SCSS adds // line comments on top of CSS's /* */ blocks. Use the dedicated SCSS landing page for .scss / .sass files.

Are values with /* inside url() safe?

+

Yes. The parser treats url("...") and url('...') contents as string literals, so any /* inside is preserved verbatim.

Will it break my media queries?

+

No. At-rules like @media, @supports, and @keyframes are language syntax and are always preserved.

Other languages

Working in something else?

Plus 35+ more languages supported in the live tool , including HTML, YAML, Dockerfile, Terraform, Solidity, and more.

Try it on your CSS code now.

Free forever. No signup. No upload. Runs entirely in your browser.

Open uncommenter