Tidy HTML
Run HTML Tidy on the current document to repair and normalise invalid or malformed HTML.
Unlike formatters such as Prettier, which clean up the presentation, Tidy HTML attempts to repair broken markup — fixing missing or mismatched closing tags, lowercasing tags and attributes, normalising structure, and cleaning up the kind of malformed HTML produced by tools like Microsoft Word or FrontPage.
The document is not saved automatically. Review the changes and save manually if satisfied, or undo with Ctrl+Z if not.
Requirements
HTML Tidy must be installed separately. Download the Windows binary from https://binaries.html-tidy.org.
Extract the archive and note the full path to tidy.exe — you will need it during setup.
Setup
After installing the extension, open Settings and search for Tidy HTML, or go to:
File → Preferences → Settings → Extensions → Tidy HTML
Set the following:
tidyHtml.tidyExe – required
Full path to tidy.exe, for example C:\Program Files\tidy 5.8.0\bin\tidy.exe.
tidyHtml.tidyConfig – optional
Full path to a Tidy config file. If not specified, Tidy runs with its default settings, for example C:\Users\YourName\.tidyrc.
A sample .tidyrc that produces clean, indented HTML5 output:
indent: yes
indent-with-tabs: yes
indent-spaces: 1
wrap: 0
output-html: yes
drop-empty-elements: no
tidy-mark: no
quiet: yes
bare: yes
Usage
Open an HTML file and run the command Tidy HTML: Run.
Optionally, assign a keyboard shortcut via File → Preferences → Keyboard Shortcuts and search for Tidy HTML: Run.
Notes
- Requires HTML Tidy to be installed separately
- Processes the entire document — selections are ignored
- Works on both saved and unsaved documents
- Does not save the file automatically
Privacy
Tidy HTML:
- Does not transmit any data
- Does not collect telemetry
- Passes document content only to the locally installed
tidy.exe process
Requirements
Visual Studio Code 1.80.0 or later.
License
MIT