LinuxCommandLibrary

tidy

Validate and reformat HTML markup

TLDR

Clean HTML file

$ tidy [input.html]
copy
Write to file
$ tidy -o [output.html] [input.html]
copy
Modify in place
$ tidy -m [file.html]
copy
Convert to XHTML
$ tidy -asxhtml [input.html]
copy
Show only errors
$ tidy -e [input.html]
copy
Indent output
$ tidy -i [input.html]
copy
Quiet mode
$ tidy -q [input.html]
copy
Wrap at column
$ tidy -w [80] [input.html]
copy

SYNOPSIS

tidy [-o output] [-m] [-i] [options] [files]

DESCRIPTION

tidy validates and reformats HTML documents, detecting markup errors such as missing closing tags, improper nesting, and deprecated elements. It can automatically fix many common problems while producing consistently formatted output with standardized indentation and line wrapping.
The tool can convert HTML to XHTML (-asxhtml) for stricter XML-compliant output, or reformat in place with -m. Error-only mode (-e) reports problems without modifying the document, useful for quick validation checks. Output wrapping width is configurable with the -w flag.

PARAMETERS

-o FILE

Output file.
-m, --modify
Modify in place.
-i, --indent
Indent content.
-e, --errors
Show errors only.
-q, --quiet
Quiet mode.
-w N, --wrap N
Wrap at column.
-asxhtml
Output as XHTML.
-ashtml
Output as HTML.
--indent-spaces N
Spaces per indent.

CAVEATS

May change whitespace. Some fixes alter rendering. Complex pages need care.

HISTORY

HTML Tidy was originally developed by Dave Raggett at W3C. It's maintained by HTACG (HTML Tidy Advocacy Community Group).

SEE ALSO

xmllint(1), prettier(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community