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
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-format-code-with-prettier-in-visual-studio-code
Format Code with Prettier in Visual Studio Code: Setup Guide | DigitalOcean
August 1, 2025 - Learn how to format code with Prettier in Visual Studio Code. This guide walks you through installing, configuring, and using Prettier for code formatting.
Discussions

Prettier not used on HTML even though its the default formatter
Summary I've configured prettier as my default formatter in workspace settings. It does work flawlessly with JS and JSON files, but HTML isn't being formatted by prettier. Apparently vscode falls b... More on github.com
🌐 github.com
2
March 24, 2022
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
Prettier-VSCode doesn't format selections in HTML documents
Summary When formatting html files with prettier-vscode configured as html-formatter, the VSCode command "Format selection" does not work. The command "Format Document" works as expected. Github Re... More on github.com
🌐 github.com
4
December 20, 2023
Speed-up your Prettier formatting using prettierd

If you want REALLY fast JS/TS/JSON/Markdown formatting then use the Deno language server: https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#denols

It is written in Rust, and the formatting is built into the Deno executable using a clone of Prettier https://dprint.dev/. You can use it as your main language server for web based JS/TS as well as Deno specific code.

(I recommend adding lint = true, now you have all the eslint/ts-eslint default lints included: https://deno.land/manual/tools/linter)

Put this on the top of files that give you errors:

/// <reference no-default-lib="true"/>
/// <reference lib="dom" />
/// <reference lib="deno.ns" />
/// <reference lib="esnext" />

By default the Deno LSP thinks it is Deno code with no DOM or APIs that are not Deno specific.

Imports for ts must include the .ts extension, I use esbuild to then create the bundle. You can use NPM and the CLI to install esbuild, or now it just got Deno support! https://github.com/evanw/esbuild/releases/tag/v0.11.11

More on reddit.com
🌐 r/neovim
29
98
September 19, 2019
People also ask

How do I install Prettier in VSCode?
Press Ctrl+Shift+X to open Extensions, search for Prettier - Code formatter, and click Install. The publisher should be Prettier. No npm installation is required for basic formatting.
🌐
tms-outsource.com
tms-outsource.com › home › how to use prettier in vscode to format code
How to Use Prettier in VSCode to Format Code - TMS
Can Prettier format HTML and CSS?
Yes. Prettier supports JavaScript, TypeScript, JSON, HTML, CSS, Markdown, YAML, GraphQL, and PHP. Language-specific settings can be added if a file does not format automatically.
🌐
tms-outsource.com
tms-outsource.com › home › how to use prettier in vscode to format code
How to Use Prettier in VSCode to Format Code - TMS
Does Prettier work with TypeScript?
Yes. Prettier fully supports TypeScript files including .ts and .tsx. It formats type annotations, interfaces, generics, and other TypeScript syntax automatically.
🌐
tms-outsource.com
tms-outsource.com › home › how to use prettier in vscode to format code
How to Use Prettier in VSCode to Format Code - TMS
🌐
YouTube
youtube.com › watch
How to Use Prettier with VS Code! (2026 Full Tutorial) - YouTube
Are you tired of messy, inconsistent code? Let's fix that with Prettier and VS Code!Prettier is an opinionated code formatter helps keep your code styling co...
Published   August 24, 2024
🌐
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 › docs › editors
Editor Integration · Prettier
prettier-vscode can be installed using the extension sidebar – it’s called “Prettier - Code formatter.” Check its repository for configuration and shortcuts.
🌐
Medium
medium.com › @karimhasibuan › how-to-force-prettier-html-formatting-to-format-tags-in-one-line-this-is-it-f0bf2a50a5b0
How to Force Prettier HTML Formatting to Format Tags in One Line? This is it! | by Karim Hasibuan | Medium
November 28, 2022 - That is the reason why i write this tutorial. Because i have problem for this. So, this is to solve! Based on my search for this problem, I found 2 ways that might help you solve this problem. If you don’t have the file, you can create this file with the name of file is .prettierrc.json in your root project directory. After that, you can add some code like this: { // Other options... "overrides": [ { // change .html with .vue if you are using Vue files instead of HTML "files": "src/**/*.html", "options": { "printWidth": 140 } } ] }
Find elsewhere
🌐
HumanKode
humankode.com › javascript › set-up-prettier-and-vs-code-to-format-your-code
Set up Prettier and VS Code to Format Your Code - HumanKode
March 28, 2025 - Prettier is a code formatter that formats javascript, typescript, html and many other formats. In this tutorial, I'll show you how to set up prettier with VS Code so that documents are automatically formatted when you save a file.
🌐
TMS Outsource
tms-outsource.com › home › how to use prettier in vscode to format code
How to Use Prettier in VSCode to Format Code - TMS
December 18, 2025 - Learn how to use Prettier in VSCode with our step-by-step guide. Beautify your code and maintain consistent formatting effortlessly!
🌐
freeCodeCamp
freecodecamp.org › news › how-to-use-prettier-in-visual-studio-code
How To Use Prettier in Visual Studio Code
March 18, 2024 - In this guide, you will learn how to install Prettier in Visual Studio Code and how to use it to format code.
🌐
Prettier
prettier.io
Prettier · Opinionated Code Formatter · Prettier
styled-components 💅 · Lightning Web Components (LWC)
🌐
Matthewseiwert
matthewseiwert.com › code › html › auto-format-code-vscode-prettier
Auto Format Code in Visual Studio Code Using Prettier
Learn how to use Prettier in VS Code to automatically align and format your code on save. Perfect for JavaScript, HTML, CSS, and more.
🌐
DEV Community
dev.to › shieldstring › how-to-set-up-prettier-code-formatter-4a2f
How to Set Up Prettier – Code Formatter - DEV Community
September 22, 2024 - One tool that can help you achieve that is Prettier—an automatic code formatter that keeps your code looking tidy, consistent, and easy to read. Prettier is an opinionated code formatter that helps ensure your code is clean, consistent, and easy to read. It supports a wide range of languages, including JavaScript, TypeScript, HTML, CSS, JSON, and more.
🌐
Robin Wieruch
robinwieruch.de › how-to-use-prettier-vscode
How to use Prettier in VS Code - Robin Wieruch
February 14, 2022 - How to install Prettier for VS Code (Visual Studio Code). Install Prettier, configure it globally to format on save, add further Prettier configuration on a global level, and use a local .prettierrc file ...
🌐
SheCodes
shecodes.io › athena › 9830-how-to-use-prettier-in-vs-code
[VS Code] - How to Use Prettier in VS Code - SheCodes | SheCodes
Learn how to use Prettier in Visual Studio Code by checking the extention installation, enabling and configuring it. Follow these steps to get your set up!
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 2478
Prettier not used on HTML even though its the default formatter · Issue #2478 · prettier/prettier-vscode
March 24, 2022 - Install/Enable prettier-vscode (in my setup it is disabled by default unless enabled in a workspace) ... Execute Format document command. The document should be formatted using prettier's rules and the prettier output console should show some ...
Author   mmarseu
🌐
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".

🌐
Gleb Bahmutov
glebbahmutov.com › blog › configure-prettier-in-vscode
How to configure Prettier and VSCode | Better world by better software
April 23, 2024 - Prettier can format many languages: JavaScript, JSON, Markdown, HTML, CSS, etc. Here is formatting CSS for example. You can configure Prettier and its VSCode extension to format your JSON files. Since there is already a default JSON formatter built into VSCode, you need to tell VSCode to ...
🌐
Salesforce Developers
developer.salesforce.com › docs › platform › sfvscode-extensions › guide › prettier.html
Prettier Code Formatter | Salesforce Extension Pack Features | Salesforce Extensions for Visual Studio Code | Salesforce Developers
After creating the local configuration file, install the Prettier extension for VS Code. If you want to ensure that all your files are formatted whenever you save them, enable the editor.formatOnSave setting in your User and Workspace Settings. You can use Prettier with a pre-commit tool to ...
🌐
GitHub
github.com › prettier › prettier-vscode
GitHub - prettier/prettier-vscode: Visual Studio Code extension for Prettier · GitHub
If you don't like the defaults, you can rebind editor.action.formatDocument and editor.action.formatSelection in the keyboard shortcuts menu of vscode. Respects editor.formatOnSave setting. You can turn on format-on-save on a per-language basis by scoping the setting: // Set the default "editor.formatOnSave": false, // Enable per-language "[javascript]": { "editor.formatOnSave": true } Format selection works on several languages depending on what Prettier itself supports.
Starred by 5.5K users
Forked by 510 users
Languages   TypeScript 78.4% | JavaScript 20.2% | PHP 0.6% | Dockerfile 0.3% | HTML 0.3% | SCSS 0.1%
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 3241
Prettier-VSCode doesn't format selections in HTML documents · Issue #3241 · prettier/prettier-vscode
December 20, 2023 - ["INFO" - 14:27:14] Extension Version: 10.1.0. ["DEBUG" - 14:27:14] Enabling Prettier globally { "languageSelector": [ { "language": "javascript" }, { "language": "mongo" }, { "language": "javascriptreact" }, { "language": "typescript" }, { "language": "typescriptreact" }, { "language": "json" }, { "language": "jsonc" }, { "language": "json5" }, { "language": "css" }, { "language": "postcss" }, { "language": "less" }, { "language": "scss" }, { "language": "handlebars" }, { "language": "graphql" }, { "language": "markdown" }, { "language": "mdx" }, { "language": "html" }, { "language": "vue" },
Author   markchagers