JavaScript, Core Web Vitals, and UK public sector standards
Unminified JavaScript is one of the primary causes of high Total Blocking Time (TBT), a Core Web Vitals metric that directly affects Lighthouse scores and search rankings. The GOV.UK Design System ships a pre-built govuk-frontend package, but many UK public sector teams add custom JavaScript on top that benefits from minification. This tool removes comments and whitespace from small scripts entirely in your browser , no data leaves your machine.
What this minifier does
- Removes
// single-line commentsand/* block comments */ - Strips leading and trailing whitespace from each line
- Reduces consecutive blank lines
- Preserves string literals and regular expressions
Minification vs bundling
| Approach | Size reduction | What it does |
|---|---|---|
| Whitespace removal (this tool) | 5-15 % | Strips comments and spaces |
| Terser / esbuild | 40-70 % | Renames vars, removes dead code, tree-shaking |
| Bundler (Vite, Webpack) | 40-80 % | Above + code splitting, lazy loading |
For a quick Lighthouse audit fix on an existing page, whitespace removal is immediate. For a new project, set up esbuild or Vite from the start , esbuild is used internally by Vite and produces production-ready output in milliseconds.
Limits and when to use a build tool instead
This tool does not rename variables, remove dead code, or perform tree-shaking. It will not break valid JavaScript, but if your script relies on comment-based annotations (JSDoc, conditional comments), verify the output. For production deployments on UK government or NHS Digital properties, integrate Terser or esbuild into your CI pipeline. See also CSS Minifier for stylesheet size reduction alongside JS.