Same for me, I managed to solve it with:

    {
        "editor.formatOnSave": true,
        "editor.formatOnPaste": true,
        "editor.formatOnType": true,
        "editor.defaultFormatter": "esbenp.prettier-vscode",
        "[html]": {
            "editor.defaultFormatter": "vscode.html-language-features"
        }
    }

This allowed me to use prettier globally and use built in html formatter for html. Also allowed the formatting to happen on save and while typing.

The part responsible for Prettier formatting html:

  "[html]": {
            "editor.defaultFormatter": "vscode.html-language-features"
        },

To open type Ctrl+Shift+P, then type open user/workspace settings JSON in the command line.

Answer from Eslam Sameh Ahmed on Stack Overflow
🌐
Prettier
prettier.io
Prettier · Opinionated Code Formatter · Prettier
HTML · Vue · Angular · Ember / Handlebars · Lightning Web Components (LWC) MJML · YAML · Markdown · CommonMark · GitHub-Flavored Markdown · MDX v1 · GraphQL · GraphQL Schemas · Community Plugins · Apex · Elm (via elm-format) Java · PHP · Ruby · Rust · TOML · XML · And more... prettier-js prettier.el Apheleia ·
Blog
We're excited to announce that Prettier now fully supports the fresh features landing in Angular v21.1 (released today 🎉) · This update brings cleaner, more expressive templates with:
Options · Prettier
By default, Prettier formats objects as multi-line if there is a newline prior to the first property. Authors can use this heuristic to contextually improve readability, though it has some downsides. See Multi-line objects. ... "preserve" - Keep as multi-line, if there is a newline between the opening brace and first property. ... Put the > of a multi-line HTML ...
Configuration File
You can configure Prettier via (in order of precedence):
🌐
FreeFormatter
freeformatter.com › html-formatter.html
Free Online HTML Formatter - FreeFormatter.com
This free online HTML formatter and validator lets you chose your indentation level and also lets you export to file
Discussions

Prettier extension not working on HTML files
First make sure that you don't have multiple extensions to format html files. Uninstall the ones that you don't need - or at least try disabling them, to see if this fixes the issue. If that didn't help you should inspect your settings.json file, trying to find anything html formatting related, that isn't configured correctly. You have a personal settings file and there might also be one in the project's .vscode folder. Bear in mind that VSCode has built in formatter for HTML. I guess that a wrongly configured settings could cause this. If this are still not working, try installing the VSCode Insiders version of the editor. It's a version that gets updated more often, but it's still pretty stable. Insiders doesn't share settings with the normal version, so this trick lets you try with a pristine version of VSCode without having to clear all your settings. More on reddit.com
🌐 r/vscode
4
5
January 29, 2022
visual studio code - How to force prettier html formatting to format tags in one line? - Stack Overflow
I use prettier in my VSC, so how to force prettier HTML formatting to format tags in one line, not multiple lines? I want to format something like this all in one line More on stackoverflow.com
🌐 stackoverflow.com
HTML Suddenly formatting improperly
Prettier is suddenly formatting html in a strange way, adding closing slashes to on their own line. In the image ... More on github.com
🌐 github.com
45
November 20, 2018
How to configure prettier in a browser to properly indent html
I want to format html just by indention. So I've found out that I can do that using prettier. Here is my current options: import prettier from 'prettier/standalone'; import htmlParser from 'prettier/ More on stackoverflow.com
🌐 stackoverflow.com
🌐
Prettier
prettier.io › docs › options
Options · Prettier
When Prettier identifies cases where it looks like you've placed some code it knows how to format within a string in another file, like in a tagged template in JavaScript with a tag named html or in code blocks in Markdown, it will by default try to format that code.
🌐
JetBrains
jetbrains.com › help › webstorm › prettier.html
Prettier | WebStorm Documentation
Prettier is a tool to format files in various languages, like TypeScript, JavaScript, CSS, HTML, JSON, and others. With WebStorm, you can format selected code fragments as well as entire files or directories using the Reformat with Prettier action.
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
Prettier - Code formatter - Visual Studio Marketplace
January 21, 2026 - Extension for Visual Studio Code - Code formatter using prettier
🌐
Prettier
prettier.io › blog › 2018 › 11 › 07 › 1.15.0.html
Prettier 1.15: HTML, Vue, Angular and MDX Support · Prettier
November 7, 2018 - It also respects decorator position, adds an option for JSX single quotes, allows parser inference via shebang, adds support for several new syntax features, and has a few formatting tweaks. Prettier can now format HTML, Vue and Angular files!
Find elsewhere
🌐
GitHub
github.com › prettier › prettier
GitHub - prettier/prettier: Prettier is an opinionated code formatter. · GitHub
JavaScript · TypeScript · Flow · JSX · JSON CSS · SCSS · Less HTML · Vue · Angular GraphQL · Markdown · YAML Your favorite language? Prettier is an opinionated code formatter.
Starred by 51.7K users
Forked by 4.7K users
Languages   JavaScript 83.3% | TypeScript 6.2% | CSS 3.0% | HTML 3.0% | SCSS 1.5% | Less 1.0%
🌐
Reddit
reddit.com › r/vscode › prettier extension not working on html files
r/vscode on Reddit: Prettier extension not working on HTML files
January 29, 2022 -

I have Prettier setup as the default formatter already and it's working fine for JSX and JS files.

The weird thing is that it works on save, so when I save it formats HTML correctly, but if I try to do it manually I get: "Extension 'Prettier - Code formatter' is configured as formatter but it cannot format 'HTML'-files".

🌐
JetBrains
jetbrains.com › help › idea › prettier.html
Prettier | IntelliJ IDEA Documentation
Prettier is a tool to format files in various languages, like TypeScript, JavaScript, CSS, HTML, JSON, and others. With IntelliJ IDEA, you can format selected code fragments as well as entire files or directories using the Reformat with Prettier ...
🌐
Prettier
prettier.io › docs
What is Prettier? · Prettier
Prettier is an opinionated code formatter with support for: JavaScript (including experimental features) JSX · Angular · Vue · Flow · TypeScript · CSS, Less, and SCSS · HTML · Ember/Handlebars · JSON · GraphQL · Markdown, including ...
🌐
Web Formatter
webformatter.com › html
HTML Formatter
Free online tool to format an ugly HTML code, making it readable and pretty, with the proper indentation.
🌐
Walkingriver
walkingriver.com › prettier
What Did Prettier Do to My HTML? – WalkingRiver.com
January 6, 2021 - Another change I did not expect is the way Prettier organizes HTML attributes when the tag has a lot of them. It formats them with one attribute per line, and closes the tag with the /> on the final line, as it did with the <a> tag above.
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 646
HTML Suddenly formatting improperly · Issue #646 · prettier/prettier-vscode
November 20, 2018 - Prettier is suddenly formatting html in a strange way, adding closing slashes to <hr> elements, dropping brackets/carats to the next line, leaving single > on their own line.
Author   silverjerk
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 360008729440-How-ca-I-get-to-run-Prettier-on-HTML-code
How ca I get to run Prettier on HTML code? – IDEs Support (IntelliJ Platform) | JetBrains
June 17, 2020 - Prettier seems to support HTML: https://prettier.io/blog/2018/11/07/1.15.0.html It would be awesome if this could be added to the "format with Prettier on save" function.
🌐
Monsterlessons-academy
monsterlessons-academy.com › posts › formatting-code-with-prettier-in-javascript
Prettier - Best Code Formatter for Javascript, React, Vue, Html, Css
Prettier is the best code formatter for lots of languages like Javascript, React, Vue, Html, Css. With the tools like Eslint you spend a lot of time tuning rules and config files.
🌐
Site24x7
site24x7.com › tools › html-beautifier.html
HTML Beautifier | Beautify HTML Code Online - Site24x7 Tools
Beautify HTML code into a human-readable and understandable format using our HTML Beautifier.