CodePress

Beautify and minify HTML, CSS and JavaScript with configurable rules.

100% client-side

Input code

0 characters

Result


        

How CodePress works

CodePress tokenizes the code respecting strings, comments and (in JS) template literals and regex, then applies indentation rules based on brace/parenthesis depth for "Beautify," or strips whitespace, comments and unnecessary line breaks for "Minify":

/* Before */
.card{color:red;padding:8px}

/* After Beautify */
.card {
  color: red;
  padding: 8px;
}

JavaScript's compact mode is deliberately conservative (it never merges lines) to avoid ASI bugs; HTML and CSS are compacted aggressively. Everything runs in your browser — no external libraries, no server calls.

Frequently asked questions

Does it use a full parser for each language?

No. It uses a tokenizer and indentation rules based on brace/parenthesis depth, similar to most lightweight online formatters — not a full compiler. Code with very unusual syntax may need manual tweaks.

Is the JavaScript compact mode as aggressive as a production minifier?

Deliberately not: it only strips comments, blank lines and indentation, but keeps the original line breaks between statements to avoid bugs from automatic semicolon insertion (ASI) that an aggressive minifier without a full parser could introduce.

Is HTML and CSS compacting just as conservative?

No, those are minified more aggressively (collapsing whitespace and stripping comments) because HTML and CSS don't have JavaScript's ASI problem — it's safe to compact them fully.

Is it safe to paste proprietary code here?

Yes. All processing happens in your browser; no code is ever sent to a server.