Jens Oliver Meiert

Use my latest work: latest tech book · latest non-tech book · latest optimization tool · latest defense tool

HTML Minifier Next: Extended Benchmarks, Self-Close Foreign Elements, Fewer Redundant Attributes, JSON Minification Opt-In

Published on Oct 23, 2026, filed under , , , , . (Share this post, e.g., on Mastodon.)

HTML Minifier Next (HMN) received another round of updates, including a new major version, 9.0.0. As in the past, the highlights:

Extended Minifier Benchmarks

If you’re not sure about HTML Minifier Next and need more data or if you’re in the market for a new minifier, the Minifier Benchmarks project is the new home to measure web page minifier effectiveness and efficiency.

The benchmarks run @swc/html, HTML Minifier Next, htmlcompressor.com, htmlnano, minify, minify-html, and Minimize on 100+ sites, comparing output size and processing time. There are currently two tests: HTML minification only, with the most aggressive settings that keep output conformant, and maximum minification, with all conformant features each minifier offers (which, however, is not a like-for-like comparison).

Minifier authors are welcome to add and configure their minifiers.

Self-Close Empty SVG and MathML Elements

With selfCloseForeignElements (part of the “comprehensive” preset), empty SVG and MathML elements can now be written as self-closing (e.g., <path d="…"></path> → <path d="…"/>). HTML elements within them, as in foreignObject, keep their end tags.

Remove More Redundant Attributes

removeRedundantAttributes now also removes namespace declarations HTML reads anyway (e.g., xmlns="http://www.w3.org/2000/svg" on inline SVG, or xmlns="http://www.w3.org/1999/xhtml" on html) as well as SVG default values—leaving alone presentation attributes (which inherit), and gradients, patterns, and filters referring to another.

Opt Into JSON Minification (if Not Using a Preset)

Until now, HMN minified JSON in script elements (like application/ld+json, importmap, or speculationrules) automatically, without a way to turn this off. As this was inconsistent with how HMN handles CSS, JavaScript, and SVG, as well as with how other minifiers handle JSON, JSON minification is now an option, minifyJSON, which (also for consistency) is off by default.

The “comprehensive” preset includes minifyJSON, but if you’ve been using the “conservative” preset, you would need to opt in explicitly.

JSON minification got more accurate at the same time: HMN used to parse and re-serialize JSON, which could change values—large numbers lost precision (12345678901234567890 became 12345678901234567000), out-of-range numbers became null, -0 became 0, and duplicate keys were dropped. HMN now only removes whitespace between tokens and shortens escapes in strings.


This is it for some of the last changes—this is a time of many useful updates both in terms of HMN correctness, effectiveness, and speed. As usual, if you run into an issue or have a suggestion, please file an issue. And if you or your organization get value out of this work on HTML Minifier Next, please support the project. Thank you!

About Me

Portrait sketch of Jens Oliver Meiert.

I’m Jens (long: Jens Oliver Meiert), and I’m an engineering lead, guerrilla philosopher, and indie publisher. I’ve worked as a technical lead and engineering manager at various companies (e.g., Google); I’m an active web and tool developer (code optimization, digital defense), a contributor to web standards (like HTML, CSS, WCAG), and a book author (O’Reilly, Frontend Dogma).

I love trying things—in web development and engineering management, but also in politics and philosophy, where I hold to one idea in particular: that we can only be well if we take good care of everyone. Here on meiert.com I talk about some of my perspectives and experiences. (Interpret charitably but be critical—and share feedback and advice that makes my work better.)