Minifier Test

An AI-generated showcase of HTML, CSS, JavaScript, SVG, and MathML for testing and comparing minification tools (used by Minifier Benchmarks).

Text Content Elements

The Art of Semantic HTML

Published on by Jane Developer

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Visit Example.com for more information.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.

— Tim Berners-Lee

Use Ctrl+S to save your work. The output will display: File saved successfully. Remember that E equals mc².

Key Concepts

Semantic HTML
Using HTML elements for their given purpose, conveying meaning to both the browser and the developer.
Accessibility
The practice of making websites usable by as many people as possible, including those with disabilities.
SEO
Search Engine Optimization — improving the visibility and ranking of web pages in organic search results.

Best Practices

  1. Use semantic elements appropriately
  2. Include alt text for images
  3. Maintain proper heading hierarchy
  4. Ensure sufficient color contrast
  5. Test with assistive technologies

Common Mistakes

  • Skipping heading levels
  • Using divs for everything
  • Ignoring form labels
  • Non-descriptive link text like "click here"

Preformatted Content

function greetUser(name) {
    if (!name) {
        console.error("Name is required");
        return;
    }

    const greeting = `Hello, ${name}! Welcome to our platform.`;
    console.log(greeting);

    return greeting;
}

// Example usage
greetUser("Developer");

The HTML specification defines CSS integration through the <style> element. Water is H2O and E=mc2 is Einstein's famous equation. Small text is often used for disclaimers and legal notices.


Contact: test@example.com
123 Web Development Lane
Code City, CC 12345

More Semantic Text

A minifier rewrites markup without changing its meaning, and the smallest useful change is often a single byte. The HTML Living Standard describes the goal as “transforming a document into a semantically equivalent one”.

Version history: 2.0 was replaced by 3.1, which ships 3,120 documents and was released on .

Measurements keep their units: 1920 × 1080 px, 20 %, ±0.5 °C.

Comments and Whitespace

Comments come in many shapes, and every one of them is something a minifier may drop, move, or break:

Regular text follows a conditional comment.

Comments in Sensitive Positions

  • Before a list item
  • After a list item
Comments between table rows
One
Two
// A comment inside <pre> is shown, not parsed
	const ratio = 16 / 9;
	/* … and a comment with a closing tag: </code> is text here. */

Whitespace That Must Survive

Spaces between inline elements are content: first link second link and an inline span next to text. A minifier that trims every run of whitespace renders this as first linksecond link.

Non-breaking spaces hold units and initials together: 10 px, 09:30 am, Mc Donald, and a no-break before a unit, such as 50 km.

A line break before this paragraph matters:


… and one after it.

Empty elements below render nothing but keep their tags:

Long tokens such as https://example.com/assets/very/long/path/minifier-benchmark-2024-06-01/report.json?section=results&rows=all&format=json need word breaking, not whitespace removal.

Preformatted Text

The newline after a <pre> start tag and the newline before its end tag are removed by the parser, which is why the indentation of the block below is meaningful:

	first line starts with a tab
		second line with two tabs

	third line after a blank line

The same rule applies to <textarea>, whose leading newline is dropped, so the placeholder below is indented by one tab:

Whitespace in Attributes and Selectors

Class lists, lang attributes, and aria values all contain meaningful spaces:

class="demo-panel demo-color break-all" lang="de-AT" aria-label="Ein Satz mit Leerzeichen" data-list="alpha beta gamma"

Embedded Content

Image with Caption

Abstract geometric pattern An abstract composition of circles, rectangles, and lines in blue and orange colors SVG Illustration
Figure 1: An example of inline SVG with gradients, filters, and geometric shapes.

Audio and Video (Placeholder Elements)

The following are placeholder elements demonstrating the structure:

Embedded Object

Unable to display PDF. Download it here.

Picture Element

Responsive image example

Frames

A plain src frame with a name, lazy loading, and a referrer policy.
The same frame with a srcdoc attribute: a whole document, including a doctype, a style element, and escaped markup, inside one attribute value.

Canvas with Fallback Content

This canvas shows a drawing script. A static fallback is shown in browsers without canvas support.

Image Map

An image map with three clickable areas Go to the text content section Go to the SVG section Go to the MathML section Go to the accessibility section
Rectangular, circular, and polygonal areas referencing fragments on this page.

Media Attributes

Entities and Encoding

Named, Decimal, and Hexadecimal References

Named references: & < > " '   © ® ™ § ¶ ° ± × ÷ ½ ¼ ≠ ≤ ≥ ≈ ∞ ♥ ♠ ♦ ♣ ✓ ✗ • † ‰ ′ ″ … — – « » ‹ › € £ ¥ ¢ ¤ ¡ ¦ ‾ ⁄ ℘ ℑ ℜ ℵ ∅ ∇ ∂ ∀ ∃ ∑ ∏ √ ∫ ∴ ∼ ≅ ∝ ⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ ⌈ ⌉ ⌊ ⌋ ⟨ ⟩ ◊ ♠.

Decimal and hexadecimal references for the same characters: & < > & < > — — – – … … © © € € ∥ ∧ ∞ ∎.

Astral plane characters need a surrogate pair when written numerically, as in 😀 (U+1F600) and 💩 (U+1F4A9); the same characters written literally look like this: 😀 💩 🚀. The document declares its encoding in <meta charset="UTF-8">.

References in Attribute Values

Where the ampersand has to be escaped
Context Source Result
In text Tom & Jerry Tom & Jerry
In an attribute title="Tom & Jerry" hover me
Escaped twice &amp; &
In a query string href="?a=1&amp;b=2" a link with two parameters
In a script URL src="app.js?v=1&amp;x" app.js with two parameters
Apostrophe in text it's it’s

Invisible and Combining Characters

A soft­hyphen, a zero​width​space, a word⁠joiner, and a quotation wrapped in left‎ and right‏ marks: “a quotation”.

Combining marks: éleݩ, nõva, ǎ and the precomposed forms é, ñ, and ü — the two spellings must not be normalized differently.

Scripts and Directionality

正體中文與簡體中文

한국어 문장

日本語のテストとふりがな

Hebrew: שלום עולם, Arabic: مرحبا بالعالم, and Latin text forced to run right to left: abc 42 def.

פסקה שכתובה מימין לשמאל, עם קישור ומספר 42.

Ruby Annotations

Fallback parentheses for browsers without ruby support: 漢字(kanji) and 日本語(nihongo). The readings 漢(kan)字(ji) use a preloaded web font.

Typography

Straight quotes "double" and 'single' beside curly “double” and ‘single’ quotes; an em dash—like this one—without surrounding spaces, an en dash – like this one – with them, a horizontal ellipsis…, a double vertical line ‖, and French spacing before punctuation: a space, a semicolon; a question? a colon: a guillemet «yes».

Attributes and URLs

Boolean Attributes

A boolean attribute is present or absent, and an empty value is still true: checked unchecked .

More boolean attributes in context: (multiple file input) and , plus open on the details elements, controls, muted, loop, and playsinline on media, novalidate on forms, itemscope on the product below, and inert on an inert container.

Quoting and Case

Attribute values can be double quoted, single quoted, unquoted, or spaced around the equals sign, and element and attribute names are case-insensitive: uppercase names.

Values with Special Characters

Quotes inside values: single-quoted with double quotes and escaped double quotes. Newlines and tabs inside a value are kept as written:

This element uses a style attribute that spans two source lines and declares a custom property.

Trailing spaces in a value: visible only in the source, and a long value: data-report='{"rows":[1,2,3],"format":"json","filter":"all","sort":"desc","limit":100}'.

Global and Data Attributes

A Widget with the identifier SKU-4711, an , and an aggregate rating of 4.5 from 128 reviews.

Arbitrary data-* attributes, aria-* attributes, and framework hooks such as is, slot, and part all survive minification unchanged: Tooltip hint

URL Forms

Reference forms and how they are written
Form Source Result
Absolute https://example.com/page example.com/page
Protocol relative //cdn.example.com/asset.css cdn.example.com/asset.css
Root relative /core/html/page.html /core/html/page.html
Document relative assets/image.webp assets/image.webp
Parent relative ../css/base.css ../css/base.css
Fragment only href="#svg" Jump to the SVG section
Query only href="?page=2&sort=name" ?page=2&sort=name
Percent encoded href="/search?q=a%20b%26c" /search?q=a%20b%26c
Mail with subject mailto:test@example.com?subject=Test test@example.com
Mail to several mailto:a@example.com,b@example.com two recipients
Telephone tel:+1234567890 +1 234 567‑890
Data URI src="data:image/svg+xml,%3Csvg…" A blue circle from a data URI

Link Relationships

Outbound with target="_blank"
A new context without window.opener
Tracked and highlighted
A sponsored link with a ping
Downloadable
A file with a suggested name
Documentation rel values
, license, help, , me, archive, ugc

Image Sources and Loading

A responsive image with width descriptors
Width descriptors (400w, 800w) with a sizes attribute and per-category loading hints.
A responsive image with pixel density descriptors
Pixel density descriptors (1x, 2x) for the same image.

An image without intrinsic dimensions, loaded cross-origin with a referrer policy: A cross-origin image.

Tabular Data

Browser Compatibility Matrix
Feature Chrome Firefox Safari Edge
CSS Grid 57+ 52+ 10.1+ 16+
CSS Flexbox 29+ 28+ 9+ 12+
ES6 Modules 61+ 60+ 10.1+ 16+
Web Components 67+ 63+ 10.1+ 79+
Last updated: January 2024

Complex Table with Row/Column Groups

Product Price Stock
Laptop Pro X1 $1,299 15
Wireless Mouse $29 142
Mechanical Keyboard $149 38

Row and Column Spans

Release schedule with row and column spans
Quarter Status Downloads
From To Version Count
2024 Supported 3.0 – 3.4
2.1 480
2025 Supported 3.5 1,200 860
Download counts are fictional and updated monthly.

Header References and Empty Cells

Explicit header references and a deliberately empty cell
Name Type Size
index.html Page
minifier-test.html Page 30 kB

Table in a Cell

A table nested inside a table cell
Plain cell
Nested caption
Nested one Nested two

Form Elements

Personal Information
Format: 555-123-4567
Preferences
Newsletter

Select topics of interest:

Preferred frequency:

Progress and Meter Elements

Download progress: 70%

Disk usage: 70%

More Input Types

Search and Reference
Dates and Times
Files and Selection
Disabled Fieldset

Autocomplete Tokens

Payment and address (long attribute values)

Constraint Attributes

Constraints by control type
Attribute Applies to Notes
required All controls except button and output Blocks submission and drives the :invalid and :valid pseudo-classes
pattern text, search, tel, url, email, password Regular expression source without delimiters
minlength, maxlength Text-like inputs and textarea Counted in UTF-16 code units, not characters
min, max, step number, range, date, time, month, week, datetime-local Step may be any or a floating-point number
multiple file, email, select Comma-separated list for email
readonly versus disabled Text-like inputs, textarea, select Read-only fields are submitted, disabled fields are not
list, size input with datalist, select, textarea size sets the visible width, not the character limit
placeholder Text-like inputs and textarea Not a label; it disappears as soon as typing starts

Output and Live Values

Live output: 3 × 19.00 = 57.00

Inline SVG Examples

Icons

Data Visualization

Monthly Sales Chart A bar chart showing sales data for each month of the year Months Sales ($) J F M A M J J A S O N 0 5k 10k 15k 20k

Complex SVG with Animations

Animated SVG

Symbols, Reuse, and Namespaces

The second <use> uses the legacy xlink:href attribute, which only works as long as the xmlns:xlink namespace declaration survives.

Paths, Markers, and Text

Text following a path padded text first tspan second tspan

Patterns, Clipping, and Masks

Nested SVG and Foreign Content

nested

HTML inside SVG: a link, a code element, and bold text.

Rendered for English Für Deutsch gerendert Fallback text

Animation Timing

Gradients, Filters, and Units

Inline MathML

The quadratic formula is represented as:

x = - b ± b 2 - 4 a c 2 a

Einstein's mass-energy equivalence:

E = m c 2

The Pythagorean theorem: a2+b2=c2

Integral example:

∫ 0 ∞ e - x d x = 1

Matrix representation:

( a b c d e f g h i )

Semantics and Annotations

Presentation MathML with a TeX annotation and a plain-text alternative:

e iπ + 1 = 0 e^{i\pi} + 1 = 0

Presentation attributes instead of CSS, and the available mathvariant values:

A + 42 ≠ R ≅ G + H + K + L

Stacks, Roots, and Enclosures

∑ i=0 n an = x0 n + v→ = x3 + a−b

Delimiters, spacing, and invisible layout elements: abx+ε

Stretchable and large operators: ∏j=1,(1n|z|≤1

Matrices, Cases, and Alignment

A = [ a b c d ] , f ( x ) = { 1π for x > 0 0 otherwise

Multi-Index Notation

T μ ν ρ = ℱ ( qk , ak )

Legacy and Deprecated Markup

These elements are obsolete but still parse, and a minifier has to keep, convert, or drop each of them deliberately:

Centered text in a nested smaller font
Big text, struck through, teletype, and CSS

A unit that cannot break: 20 KB, and text that used to scroll.

The raw text elements below keep their content verbatim, including </b>, &, and <b>:

<b>not bold</b> &amp; not an entity Two spaces of indentation and one tab

Presentational Attributes

A table laid out with presentational attributes only
30 % wide Right aligned, top aligned, 40 px high

Retired Plug-in Elements

Plug-in based controls

Alternative content for the applet.

Obsolete Attributes

Image alignment, border, hspace, vspace, longdesc, ismap, and lowsrc all still parse: A legacy image

Frame-based layouts used <frameset>, <frame>, and <noframes>, scripts carried a language attribute, and the alink, link, text, and vlink attributes once lived on <body>.

CSS Feature Coverage

The stylesheet of this page exercises the features below, and the block at its end repeats most of them as unused rules.

Cascade Layers

Layered panel

Three @layer blocks set the border style, the background, and the heading background. The unlayered .demo-panel rule wins over all three.

Container Queries

Narrow

Below 34rem of container width, the cards stack their content vertically.

Wide

Wider containers switch the cards to a row layout, because the main grid already stretches them.

Relative Selectors

With a badge

New

Cards with a badge are outlined by :has(.badge), and the badge itself adds an arrow through ::after.

Without a badge

A card with two paragraphs in a row is styled by :has(> h4 + p + p).

This one keeps the muted color.

Checkbox Tabs

The panel visibility uses :checked with the general sibling combinator, and the labels are selected with an attribute selector.

The hidden radios stay in the tab order, so :focus-visible can draw a focus ring on the label list.

Generated Content

A drop cap is drawn with ::first-letter, which is a common reason for minifiers to lose whitespace inside text.

A quotation with decorative quotation marks from ::before and ::after.

  • List markers restyled with ::marker
  • Selection colors from ::selection on the panels above

Fluid Sizing and Aspect Ratios

Clamped type

A paragraph with a maximum measure and text-wrap: balance, which falls back silently where the property is unsupported.

Color Functions

A panel with color-scheme: light dark and light-dark() colors, so it follows the operating system.

Registered Custom Properties

The conic gradient above animates --demo-angle, registered through @property, which makes a custom property animatable and interpolatable.

Figures, Progress, and Status

Minification is a trade-off between bytes and debuggability, and the tools that hide it best are not always the tools that break it least.

— An anonymous reviewer

A dashed status box for live regions, notifications, and toasts.

Accessibility and ARIA

Accessibility attributes are as fragile as everything else on this page: a minifier that drops an unknown attribute silently removes behaviour.

Landmarks and Names

Labelled and Described Groups

Region with a label

An error message is linked with aria-describedby and referenced again with aria-errormessage:

Please enter a name with at least two characters.

Tabs, Toggles, and Live Regions

The first panel, referenced by aria-labelledby.

This status region is polite, atomic, and empty of announcements until script fills it.

This log region is intentionally silent.

Images, Icons, and Hidden Text

Decorative icons are hidden from assistive technology with aria-hidden="true" and focusable="false", while meaningful graphics get a role and a label: .

An image with an empty alt attribute is decorative and needs no label.

Screen reader only text.

Link with a descriptive label

Table Semantics

Scores with row and column headers
Section Score
Accessibility 4.5
Performance 4.2

Higher is better, based on a fictional study.

Keyboard and Interaction Attributes

tabindex="0"
The panel above is focusable so that it can be scrolled with the keyboard.
tabindex="-1"
The second tab stays out of the tab order until it is selected.
accesskey
A link with the access key “a”.
draggable and contenteditable
Editable and draggable text.
popover
The popover in the interactive section uses the attribute without a value.

Interactive Elements

Details and Summary

What is HTML minification?

HTML minification is the process of removing unnecessary characters from HTML code without changing its functionality. This includes removing whitespace, comments, and sometimes shortening class names or removing unused CSS.

Why is minification important?

Minification reduces file sizes, which leads to faster page loads and reduced bandwidth usage. This improves user experience and can positively impact search engine rankings.

Best practices for minification
  • Always keep unminified versions for development
  • Use source maps for debugging
  • Test thoroughly after minification
  • Consider compression (gzip, brotli) in addition to minification

Dialog Element

Test Dialog

This is a native HTML dialog element. It can be opened and closed via JavaScript.

Template Element

Popover

Popover panel

A popover opens through popovertarget and closes through light dismiss, without any script. The attribute also works without a value.

Exclusive Details

Do optional end tags change rendering?

No. The parser closes them at the same points, which is what the optional end tags section shows.

Does minification reorder attributes?

Attribute order carries no meaning, except for a duplicated attribute, where the parser keeps the first one.

Table Row Template

Rows cloned from a template
Tool Ratio
Baseline 100 %

Inline Script Hazards

The script below holds constructs that minifiers regularly break: angle brackets in comments and comparisons, an escaped closing tag, a regular expression, a template literal, optional chaining, and a thrown error.

The script writes its results here.

Optional End Tags and Legacy Parsing

HTML5 lets a number of end tags be left out. The parser closes them at fixed points, so a minifier that adds or removes them changes nothing—but one that adds them in the wrong place does.

Paragraphs and Line Items

The first paragraph ends where the second one starts, without any closing tags

The second paragraph ends with the list below

  • A list item that ends at the next item
  • A second item
  • A third item

Ordered lists keep their numbering in reverse:

  1. c
  2. b
  3. a

Table Structure

Every cell in this table is closed implicitly
ElementEnd tag
troptional when a new tr follows
tdoptional at the end of a row
tbodyoptional at the end of a table

Definitions and Options

A term without a closing tag
A description closed by the next dt
A second term
The last description before the closing dl tag

Options behave the same way:

Case and Whitespace in Tags

Uppercase element names are lowercased by the parser

Attribute names are lowercased too

An uppercase link

An obsolete presentational attribute, kept for the parser test

Unquoted and Spaced Attribute Values

Values may be unquoted, as in this link, or spaced around the equals sign, as in that link. An empty value is allowed too, which is why the field below has an attribute but no text:

Void Elements

Void elements are never closed. An <img> with an empty alt attribute renders as a tiny broken image box , a <br> ends the line where it stands,
a <wbr> offers a break opportunity inside transforming, and a hidden input renders nothing at all . A horizontal rule is void as well:


…so the paragraph below it needs no closing tag either.