OS Manuals

/usr/bin/tidy

HTML parser, cleaner and pretty-printer

From tidy-html5 5.8.0-r0 (os), captured 2026-11-05 by running tidy --help (exit 0). permalink

tidy [options...] [file...] [options...] [file...]
Utility to clean up and pretty print HTML/XHTML/XML.

This is modern HTML Tidy version 5.8.0.


Command Line Arguments for HTML Tidy for Linux:
===============================================

File manipulation
-----------------
 -output <file>, -o <file>  write output to the specified <file>
 -config <file>             set configuration options from the specified
                            <file>
 -file <file>, -f <file>    write errors and warnings to the specified <file>
 -modify, -m                modify the original input files

Processing directives
---------------------
 -indent, -i                indent element content
 -wrap <column>, -w         wrap text at the specified <column>. 0 is assumed
 <column>                   if <column> is missing. When this option is
                            omitted, the default of the configuration option
                            'wrap' applies.
 -upper, -u                 force tags to upper case
 -clean, -c                 replace FONT, NOBR and CENTER tags with CSS
 -bare, -b                  strip out smart quotes and em dashes, etc.
 -gdoc, -g                  produce clean version of html exported by Google
                            Docs
 -numeric, -n               output numeric rather than named entities
 -errors, -e                show only errors and warnings
 -quiet, -q                 suppress nonessential output
 -omit                      omit optional start tags and end tags
 -xml                       specify the input is well formed XML
 -asxml, -asxhtml           convert HTML to well formed XHTML
 -ashtml                    force XHTML to well formed HTML
 -access <level>            do additional accessibility checks (<level> = 0,
                            1, 2, 3). 0 is assumed if <level> is missing.

Character encodings
-------------------
 -raw                       output values above 127 without conversion to
                            entities
 -ascii                     use ISO-8859-1 for input, US-ASCII for output
 -latin0                    use ISO-8859-15 for input, US-ASCII for output
 -latin1                    use ISO-8859-1 for both input and output
 -iso2022                   use ISO-2022 for both input and output
 -utf8                      use UTF-8 for both input and output
 -mac                       use MacRoman for input, US-ASCII for output
 -win1252                   use Windows-1252 for input, US-ASCII for output
 -ibm858                    use IBM-858 (CP850+Euro) for input, US-ASCII for
                            output
 -utf16le                   use UTF-16LE for both input and output
 -utf16be                   use UTF-16BE for both input and output
 -utf16                     use UTF-16 for both input and output
 -big5                      use Big5 for both input and output
 -shiftjis                  use Shift_JIS for both input and output

Miscellaneous
-------------
 -version, -v               show the version of Tidy
 -help, -h, -?              list the command line options
 -help-config               list all configuration options
 -help-env                  show information about the environment and runtime
                            configuration
 -show-config               list the current configuration settings
 -export-config             list the current configuration settings, suitable
                            for a config file
 -export-default-config     list the default configuration settings, suitable
                            for a config file
 -help-option <option>      show a description of the <option>
 -language <lang>           set Tidy's output language to <lang>. Specify
                            '-language help' for more help. Use before
                            output-causing arguments to ensure the language
                            takes effect, e.g.,`tidy -lang es -lang help`.

XML
---
 -xml-help                  list the command line options in XML format
 -xml-config                list all configuration options in XML format
 -xml-strings               output all of Tidy's strings in XML format
 -xml-error-strings         output error constants and strings in XML format
 -xml-options-strings       output option descriptions in XML format



Tidy Configuration Options
==========================
 Use Tidy's configuration options as command line arguments in the form
 of "--some-option <value>", for example, "--indent-with-tabs yes".

 You can also specify a file containing configuration options with the
 -config <file> directive, or in one or more files specific to your
 environment (see next section).

 For a list of all configuration options, use "-help-config" or refer
 to the man page (if your OS has one).

Configuration Files
===================
 If your environment has an $HTML_TIDY variable set to point to a Tidy
 configuration file, then Tidy will attempt to use it.

 Additionally, Tidy will automatically attempt to use configuration specified
 in these files, if present:

  /etc/tidy.conf
  ~/.tidyrc

 Use "-help-env" for more information about how you can use the environment.
 to specify Tidy options.

Other
=====
 Input/Output default to stdin/stdout respectively.

 Single letter options apart from -f may be combined
 as in:  tidy -f errs.txt -imu foo.html

Information
===========
 For more information about HTML Tidy, see
  http://www.html-tidy.org/

 For more information on HTML, see the following:

   HTML: Edition for Web Authors (the latest HTML specification)
   http://dev.w3.org/html5/spec-author-view

   HTML: The Markup Language (an HTML language reference)
   http://dev.w3.org/html5/markup/

 File bug reports at https://github.com/htacg/tidy-html5/issues/
 or send questions and comments to public-htacg@w3.org.

 Validate your HTML documents using the W3C Nu Markup Validator:
   http://validator.w3.org/nu/
Options (146)
OptionDescriptionSource
-output, -o filewrite output to the specified <file>help + man
-config fileset configuration options from the specified <file>help + man
-file, -f filewrite errors and warnings to the specified <file>help + man
-modify, -m (write-back:modify the original input fileshelp + man
-indent, -i (indent:indent element contenthelp + man
-wrap, -w columnwrap text at the specified <column>.help + man
-upper, -u (uppercase-tags:force tags to upper casehelp + man
-clean, -c (clean:replace FONT, NOBR and CENTER tags with CSShelp + man
-bare, -b (bare:strip out smart quotes and em dashes, etc.help + man
-gdoc, -g (gdoc:produce clean version of html exported by Google Docshelp + man
-numeric, -n (numeric-entities:output numeric rather than named entitieshelp + man
-errors, -e (markup:show only errors and warningshelp + man
-quiet, -q (quiet:suppress nonessential outputhelp + man
-omit (omit-optional-tags:omit optional start tags and end tagshelp + man
-xml (input-xml:specify the input is well formed XMLhelp + man
-asxml, -asxhtml (output-xhtml:convert HTML to well formed XHTMLhelp + man
-ashtml (output-html:force XHTML to well formed HTMLhelp + man
-access leveldo additional accessibility checks (<level> = 0, 1, 2, 3).help + man
-rawoutput values above 127 without conversion to entitieshelp + man
-asciiuse ISO-8859-1 for input, US-ASCII for outputhelp + man
-latin0use ISO-8859-15 for input, US-ASCII for outputhelp + man
-latin1use ISO-8859-1 for both input and outputhelp + man
-iso2022use ISO-2022 for both input and outputhelp + man
-utf8use UTF-8 for both input and outputhelp + man
-macuse MacRoman for input, US-ASCII for outputhelp + man
-win1252use Windows-1252 for input, US-ASCII for outputhelp + man
-ibm858use IBM-858 (CP850+Euro) for input, US-ASCII for outputhelp + man
-utf16leuse UTF-16LE for both input and outputhelp + man
-utf16beuse UTF-16BE for both input and outputhelp + man
-utf16use UTF-16 for both input and outputhelp + man
-big5use Big5 for both input and outputhelp + man
-shiftjisuse Shift_JIS for both input and outputhelp + man
-version, -vshow the version of Tidyhelp + man
-help, -h, -?list the command line optionshelp + man
-help-configlist all configuration optionshelp + man
-help-envshow information about the environment and runtime configurationhelp + man
-show-configlist the current configuration settingshelp + man
-export-configlist the current configuration settings, suitable for a config filehelp + man
-export-default-configlist the default configuration settings, suitable for a config filehelp + man
-help-option optionshow a description of the <option>help + man
-language langset Tidy's output language to <lang>.help + man
-xml-helplist the command line options in XML formathelp + man
-xml-configlist all configuration options in XML formathelp + man
-xml-stringsoutput all of Tidy's strings in XML formathelp + man
-xml-error-stringsoutput error constants and strings in XML formathelp + man
-xml-options-stringsoutput option descriptions in XML formathelp + man
--gnu-emacs BooleanThis option specifies that Tidy should change the format for reporting errors and warnings to a format that is more easily parsed by GNU Emacs or some other program. (in the manual page but not in --help)man
--markup BooleanThis option specifies if Tidy should generate a pretty printed version of the markup. (in the manual page but not in --help)man
--mute StringUse this option to prevent Tidy from displaying certain types of report output, for example, for conditions that you wish to ignore. (in the manual page but not in --help)man
--mute-id BooleanThis option indicates whether or not Tidy should display message ID's with each of its error reports. (in the manual page but not in --help)man
--quiet BooleanWhen enabled, this option limits Tidy's non-document output to report only document warnings and errors. (in the manual page but not in --help)man
--show-body-only EnumSupported values: no, yes, auto (in the manual page but not in --help)man
--show-errors IntegerThis option specifies the number Tidy uses to determine if further errors should be shown. (in the manual page but not in --help)man
--show-filename BooleanThis option specifies if Tidy should show the filename in messages. (in the manual page but not in --help)man
--show-info BooleanThis option specifies if Tidy should display info-level messages. (in the manual page but not in --help)man
--show-warnings BooleanThis option specifies if Tidy should suppress warnings. (in the manual page but not in --help)man
--add-meta-charset BooleanThis option, when enabled, adds a <meta> element and sets the charset attribute to the encoding of the document. (in the manual page but not in --help)man
--add-xml-decl BooleanThis option specifies if Tidy should add the XML declaration when outputting XML or XHTML. (in the manual page but not in --help)man
--add-xml-space BooleanThis option specifies if Tidy should add xml:space="preserve" to elements such as <pre>, <style> and <script> when generating XML. (in the manual page but not in --help)man
--doctype StringThis option specifies the DOCTYPE declaration generated by Tidy. (in the manual page but not in --help)man
--input-xml BooleanThis option specifies if Tidy should use the XML parser rather than the error correcting HTML parser. (in the manual page but not in --help)man
--output-html BooleanThis option specifies if Tidy should generate pretty printed output, writing it as HTML. (in the manual page but not in --help)man
--output-xhtml BooleanThis option specifies if Tidy should generate pretty printed output, writing it as extensible HTML. (in the manual page but not in --help)man
--output-xml BooleanThis option specifies if Tidy should pretty print output, writing it as well-formed XML. (in the manual page but not in --help)man
--error-file StringThis option specifies the error file Tidy uses for errors and warnings. (in the manual page but not in --help)man
--keep-time BooleanThis option specifies if Tidy should keep the original modification time of files that Tidy modifies in place. (in the manual page but not in --help)man
--output-file StringThis option specifies the output file Tidy uses for markup. (in the manual page but not in --help)man
--write-back BooleanThis option specifies if Tidy should write back the tidied markup to the same file it read from. (in the manual page but not in --help)man
--accessibility-check EnumSupported values: 0 (Tidy Classic), 1 (Priority 1 Checks), 2 (Priority 2 Checks), 3 (Priority 3 Checks) (in the manual page but not in --help)man
--force-output BooleanThis option specifies if Tidy should produce output even if errors are encountered. (in the manual page but not in --help)man
--show-meta-change BooleanThis option enables a message whenever Tidy changes the content attribute of a meta charset declaration to match the encoding of the document. (in the manual page but not in --help)man
--warn-proprietary-attributes BooleanThis option specifies if Tidy should warn on proprietary attributes. (in the manual page but not in --help)man
--char-encoding EncodingSupported values: raw, ascii, latin0, latin1, utf8, iso2022, mac, win1252, ibm858, utf16le, utf16be, utf16, big5, shiftjis (in the manual page but not in --help)man
--input-encoding EncodingSupported values: raw, ascii, latin0, latin1, utf8, iso2022, mac, win1252, ibm858, utf16le, utf16be, utf16, big5, shiftjis (in the manual page but not in --help)man
--newline EnumSupported values: LF, CRLF, CR (in the manual page but not in --help)man
--output-bom EnumSupported values: no, yes, auto (in the manual page but not in --help)man
--output-encoding EncodingSupported values: raw, ascii, latin0, latin1, utf8, iso2022, mac, win1252, ibm858, utf16le, utf16be, utf16, big5, shiftjis (in the manual page but not in --help)man
--bare BooleanThis option specifies if Tidy should replace smart quotes and em dashes with ASCII, and output spaces rather than non-breaking spaces, where they exist in the input. (in the manual page but not in --help)man
--clean BooleanThis option specifies if Tidy should perform cleaning of some legacy presentational tags (currently <i>, <b>, <center> when enclosed within appropriate inline tags, and <font>). (in the manual page but not in --help)man
--drop-empty-elements BooleanThis option specifies if Tidy should discard empty elements. (in the manual page but not in --help)man
--drop-empty-paras BooleanThis option specifies if Tidy should discard empty paragraphs. (in the manual page but not in --help)man
--drop-proprietary-attributes BooleanThis option specifies if Tidy should strip out proprietary attributes, such as Microsoft data binding attributes. (in the manual page but not in --help)man
--gdoc BooleanThis option specifies if Tidy should enable specific behavior for cleaning up HTML exported from Google Docs. (in the manual page but not in --help)man
--logical-emphasis BooleanThis option specifies if Tidy should replace any occurrence of <i> with <em> and any occurrence of <b> with <strong>. (in the manual page but not in --help)man
--merge-divs EnumSupported values: no, yes, auto (in the manual page but not in --help)man
--merge-spans EnumSupported values: no, yes, auto (in the manual page but not in --help)man
--word-2000 BooleanThis option specifies if Tidy should go to great pains to strip out all the surplus stuff Microsoft Word 2000 inserts when you save Word documents as "Web pages". (in the manual page but not in --help)man
--ascii-chars BooleanCan be used to modify behavior of the clean option when set to yes. (in the manual page but not in --help)man
--ncr BooleanThis option specifies if Tidy should allow numeric character references. (in the manual page but not in --help)man
--numeric-entities BooleanThis option specifies if Tidy should output entities other than the built-in HTML entities (&, <, >, and ") in the numeric rather than the named entity form. (in the manual page but not in --help)man
--preserve-entities BooleanThis option specifies if Tidy should preserve well-formed entities as found in the input. (in the manual page but not in --help)man
--quote-ampersand BooleanThis option specifies if Tidy should output unadorned & characters as &, in legacy doctypes only. (in the manual page but not in --help)man
--quote-marks BooleanThis option specifies if Tidy should output " characters as " as is preferred by some editing environments. (in the manual page but not in --help)man
--quote-nbsp BooleanThis option specifies if Tidy should output non-breaking space characters as entities, rather than as the Unicode character value 160 (decimal). (in the manual page but not in --help)man
--alt-text StringThis option specifies the default alt= text Tidy uses for <img> attributes when the alt= attribute is missing. (in the manual page but not in --help)man
--anchor-as-name BooleanThis option controls the deletion or addition of the name attribute in elements where it can serve as anchor. (in the manual page but not in --help)man
--assume-xml-procins BooleanThis option specifies if Tidy should change the parsing of processing instructions to require ?> as the terminator rather than >. (in the manual page but not in --help)man
--coerce-endtags BooleanThis option specifies if Tidy should coerce a start tag into an end tag in cases where it looks like an end tag was probably intended; (in the manual page but not in --help)man
--css-prefix StringThis option specifies the prefix that Tidy uses for styles rules. (in the manual page but not in --help)man
--custom-tags EnumSupported values: no, blocklevel, empty, inline, pre (in the manual page but not in --help)man
--enclose-block-text BooleanThis option specifies if Tidy should insert a <p> element to enclose any text it finds in any element that allows mixed content for HTML transitional but not HTML strict. (in the manual page but not in --help)man
--enclose-text BooleanThis option specifies if Tidy should enclose any text it finds in the body element within a <p> element. (in the manual page but not in --help)man
--escape-scripts BooleanThis option causes items that look like closing tags, like </g to be escaped to </g. (in the manual page but not in --help)man
--fix-backslash BooleanThis option specifies if Tidy should replace backslash characters in URLs with forward slashes /. (in the manual page but not in --help)man
--fix-bad-comments EnumSupported values: no, yes, auto (in the manual page but not in --help)man
--fix-style-tags BooleanThis option specifies if Tidy should move all style tags to the head of the document. (in the manual page but not in --help)man
--fix-uri BooleanThis option specifies if Tidy should check attribute values that carry URIs for illegal characters and if such are found, escape them as HTML4 recommends. (in the manual page but not in --help)man
--literal-attributes BooleanThis option specifies how Tidy deals with whitespace characters within attribute values. (in the manual page but not in --help)man
--lower-literals BooleanThis option specifies if Tidy should convert the value of an attribute that takes a list of predefined values to lower case. (in the manual page but not in --help)man
--repeated-attributes EnumSupported values: keep-first, keep-last (in the manual page but not in --help)man
--skip-nested BooleanThis option specifies that Tidy should skip nested tags when parsing script and style data. (in the manual page but not in --help)man
--strict-tags-attributes BooleanThis options ensures that tags and attributes are applicable for the version of HTML that Tidy outputs. (in the manual page but not in --help)man
--uppercase-attributes EnumSupported values: no, yes, preserve (in the manual page but not in --help)man
--uppercase-tags BooleanThis option specifies if Tidy should output tag names in upper case. (in the manual page but not in --help)man
--decorate-inferred-ul BooleanThis option specifies if Tidy should decorate inferred <ul> elements with some CSS markup to avoid indentation to the right. (in the manual page but not in --help)man
--escape-cdata BooleanThis option specifies if Tidy should convert <![CDATA[]]> sections to normal text. (in the manual page but not in --help)man
--hide-comments BooleanThis option specifies if Tidy should not print out comments. (in the manual page but not in --help)man
--join-classes BooleanThis option specifies if Tidy should combine class names to generate a single, new class name if multiple class assignments are detected on an element. (in the manual page but not in --help)man
--join-styles BooleanThis option specifies if Tidy should combine styles to generate a single, new style if multiple style values are detected on an element. (in the manual page but not in --help)man
--merge-emphasis BooleanThis option specifies if Tidy should merge nested <b> and <i> elements; (in the manual page but not in --help)man
--replace-color BooleanThis option specifies if Tidy should replace numeric values in color attributes with HTML/XHTML color names where defined, e.g. replace #ffffff with white. (in the manual page but not in --help)man
--new-blocklevel-tags TagSupported values: tagX, tagY, ... (in the manual page but not in --help)man
--new-empty-tags TagSupported values: tagX, tagY, ... (in the manual page but not in --help)man
--new-inline-tags TagSupported values: tagX, tagY, ... (in the manual page but not in --help)man
--new-pre-tags TagSupported values: tagX, tagY, ... (in the manual page but not in --help)man
--break-before-br BooleanThis option specifies if Tidy should output a line break before each <br> element. (in the manual page but not in --help)man
--indent EnumSupported values: no, yes, auto (in the manual page but not in --help)man
--indent-attributes BooleanThis option specifies if Tidy should begin each attribute on a new line. (in the manual page but not in --help)man
--indent-cdata BooleanThis option specifies if Tidy should indent <![CDATA[]]> sections. (in the manual page but not in --help)man
--indent-spaces IntegerThis option specifies the number of spaces or tabs that Tidy uses to indent content when indent is enabled. (in the manual page but not in --help)man
--indent-with-tabs BooleanThis option specifies if Tidy should indent with tabs instead of spaces, assuming indent is yes. (in the manual page but not in --help)man
--keep-tabs BooleanWith the default no Tidy will replace all source tabs with spaces, controlled by the option tab-size, and the current line offset. (in the manual page but not in --help)man
--omit-optional-tags BooleanThis option specifies if Tidy should omit optional start tags and end tags when generating output. (in the manual page but not in --help)man
--priority-attributes AttributesSupported values: attributeX, attributeY, ... (in the manual page but not in --help)man
--punctuation-wrap BooleanThis option specifies if Tidy should line wrap after some Unicode or Chinese punctuation characters. (in the manual page but not in --help)man
--sort-attributes EnumSupported values: none, alpha (in the manual page but not in --help)man
--tab-size IntegerThis option specifies the number of columns that Tidy uses between successive tab stops. (in the manual page but not in --help)man
--tidy-mark BooleanThis option specifies if Tidy should add a meta element to the document head to indicate that the document has been tidied. (in the manual page but not in --help)man
--vertical-space EnumSupported values: no, yes, auto (in the manual page but not in --help)man
--wrap IntegerThis option specifies the right margin Tidy uses for line wrapping. (in the manual page but not in --help)man
--wrap-asp BooleanThis option specifies if Tidy should line wrap text contained within ASP pseudo elements, which look like: <% ... (in the manual page but not in --help)man
--wrap-attributes BooleanThis option specifies if Tidy should line-wrap attribute values, meaning that if the value of an attribute causes a line to exceed the width specified by wrap, Tidy will add one or more line breaks… (in the manual page but not in --help)man
--wrap-jste BooleanThis option specifies if Tidy should line wrap text contained within JSTE pseudo elements, which look like: <# ... (in the manual page but not in --help)man
--wrap-php BooleanThis option specifies if Tidy should add a new line after a PHP pseudo elements, which look like: <?php ... (in the manual page but not in --help)man
--wrap-script-literals BooleanThis option specifies if Tidy should line wrap string literals assigned to element event handler attributes, such as element.onmouseover(). (in the manual page but not in --help)man
--wrap-sections BooleanThis option specifies if Tidy should line wrap text contained within <![ ... (in the manual page but not in --help)man
Exit status (3) from the manual page
0All input files were processed successfully.
1There were warnings.
2There were errors.

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.