7 Best YAML Extensions for VS Code in 2026 (Tested & Ranked)
On this page
VS Code includes basic YAML highlighting, but schema-driven files benefit from validation and completion. YAML by Red Hat is the best starting point, adding schema-aware diagnostics, suggestions, hover information, and formatting for common formats and custom schemas.
Install it from the Extensions panel by searching for "YAML" by Red Hat. The remaining extensions address narrower needs such as Kubernetes cluster access, key sorting, shared formatting, clearer indentation, TOML support, and more visible diagnostics.
The seven options below help you build a VS Code YAML setup without installing several extensions that perform the same job.
1. YAML by Red Hat (Best for Most Users)
YAML by Red Hat is the most complete YAML extension in this list. It combines validation, completion, hover information, document outlining, and formatting. SchemaStore handles many common file patterns, while yaml.schemas lets you map custom formats.
Open the Extensions panel with Cmd/Ctrl + Shift + X and search for "YAML" by Red Hat. You can also install it with code --install-extension redhat.vscode-yaml.
What you get:
- Schema validation through SchemaStore, explicit schema mappings, modelines, or an inline $schema property
- Context-aware auto-completion based on schema (knows valid keys for current position)
- Real-time error detection as you type (catches indentation issues, type mismatches, missing required fields)
- Hover documentation showing field descriptions from schemas
- Document formatting through "Format Document" or format on save
- Custom schema support for proprietary YAML formats
- Multi-document YAML file support (files with --- separators)
What you don't get:
- Visual tree view for nested structures
- Diff tool for comparing YAML files
- Kubernetes cluster management (use Kubernetes extension for that)
- Custom priority sorting for keys (use YAML Sort for that workflow)
Schema configuration for custom formats:
Remote schema:
"yaml.schemas": {
"https://json.schemastore.org/github-workflow.json": ".github/workflows/*.yaml"
}Use public schema from SchemaStore.
Local schema:
"yaml.schemas": {
"./custom-schema.json": "config/*.yaml"
}Use project-specific schema file.
Multiple patterns:
"yaml.schemas": {
"schema.json": ["config/*.yaml", "settings/*.yml"]
}Apply one schema to multiple file patterns.
When this is best:
Choose Red Hat YAML when you regularly edit Kubernetes manifests, CI/CD files, or other schema-driven YAML. It is the extension to install first; add another only for a distinct need such as cluster access, custom sorting, or inline diagnostics.
2. Kubernetes by Microsoft (Best for Kubernetes Workflows)
Kubernetes by Microsoft adds cluster management to VS Code. You can edit a manifest, inspect the active cluster, and apply the file from the same workspace.
Search for "Kubernetes" by Microsoft in the Extensions panel, or run code --install-extension ms-kubernetes-tools.vscode-kubernetes-tools. The extension requires a working kubectl configuration.
What you get:
- Cluster explorer sidebar showing deployments, services, pods, ConfigMaps, Secrets in tree view
- Manifest validation with Kubernetes schema support (complements Red Hat YAML)
- Right-click "Apply" command to deploy YAML directly from editor
- Pod log viewer integrated into VS Code (no Terminal needed)
- Port forwarding UI for local access to cluster services
- Helm chart creation, linting, and template preview
- Run resource descriptions through the extension's Kubernetes commands
- Debug containers with VS Code debugger attached to pods
What you don't get:
- Advanced multi-cluster management at scale (use Lens or k9s for that)
- Complex Helm templating beyond basic preview (install Helm extension)
- YAML editing outside Kubernetes context
- Cluster commands without kubectl and a configured context
Kubernetes-specific commands:
When this is best:
Choose this extension when you regularly browse resources, apply manifests, inspect logs, or work with Helm charts. Pair it with Red Hat YAML: one supplies the YAML language features, while the other handles cluster interaction.
3. YAML Sort (Best for Organizing Large Files)
YAML Sort by PascalReitermann93 sorts YAML keys alphabetically or by a custom order. It helps teams keep large configuration files and Kubernetes manifests arranged consistently.
Install via command line: code --install-extension PascalReitermann93.vscode-yaml-sort or search "YAML Sort" in Extensions panel.
What you get:
- Alphabetical key sorting for consistent file structure
- Custom sort order with priority keywords
- Recursive sorting for nested structures
- Preserves comments during sorting
- Works with multi-document YAML files (--- separators)
- Format validation before sorting
- Undo support for sorting operations
- Configurable sorting depth and rules
What you don't get:
- Schema validation or auto-completion
- Real-time error detection
- Hover documentation
- Safe sorting when key order carries application-specific meaning
Custom sort configuration:
Kubernetes workflow:
Open a Kubernetes deployment with keys in random order. Run "Sort YAML" from the Command Palette. Keys rearrange to standard order: apiVersion, kind, metadata, spec. This makes diffs cleaner and code reviews easier.
When this is best:
Choose YAML Sort when several contributors edit the same configuration files and inconsistent key placement creates noisy diffs. Combine it with Red Hat YAML when you need both schema validation and a repeatable key order.
4. Prettier (Best for Multi-Language Formatting)
Prettier by Prettier is an opinionated formatter that handles YAML alongside JavaScript, TypeScript, JSON, Markdown, and other supported languages.
Install via command line: code --install-extension esbenp.prettier-vscode or search "Prettier - Code formatter" in Extensions panel.
What you get:
- Consistent formatting across YAML, JSON, JavaScript, TypeScript, HTML, CSS, Markdown
- Opinionated formatting that ends style debates
- Format on save for automatic consistency
- Team-wide formatting with shared .prettierrc config file
- Preserves code semantics while improving readability
- Integration with build tools and CI/CD pipelines
- Support for a project-local Prettier version and plugins
What you don't get:
- YAML schema validation or error detection
- Auto-completion based on schemas
- Language-specific features beyond formatting
- Flexibility for highly customized formatting rules
Prettier configuration for YAML:
When this is best:
Choose Prettier when the repository already uses it for JavaScript, TypeScript, JSON, or Markdown and YAML should follow the same formatting process. Keep Red Hat YAML installed for validation and schema-aware completion.
5. indent-rainbow (Best for Visual Indentation)
indent-rainbow colorizes indentation levels so misaligned YAML is visible immediately. It is useful for indentation-sensitive languages like YAML and Python.
Install via command line: code --install-extension oderwat.indent-rainbow or search "indent-rainbow" in Extensions panel.
What you get:
- Color-coded indentation levels with subtle background colors
- Instant visual detection of misaligned indentation
- Configurable colors per indentation level
- Works with multiple indentation-sensitive languages (YAML, Python, Terraform, etc.)
- Separate colors for tabs vs spaces
- Error highlighting for mixed tabs and spaces
What you don't get:
- YAML-specific validation or formatting
- Schema awareness or auto-completion
- Any language-specific features
Why this matters for YAML:
Incorrect indentation can change YAML structure or cause a parsing error. The alternating colors make unusual spacing easier to notice before you save.
Example indentation colors:
When this is best:
Choose indent-rainbow when deeply nested YAML is difficult to scan or spacing mistakes are easy to miss. It is a visual aid for YAML and other indentation-sensitive languages, not a validator.
6. Even Better TOML (Best for Multi-Format Projects)
Even Better TOML is a TOML extension, not a YAML editor. It belongs in this workflow only when the same repository uses YAML for automation or infrastructure and TOML for application or package configuration.
Install via command line: code --install-extension tamasfe.even-better-toml or search "Even Better TOML" in Extensions panel.
What you get:
- TOML syntax highlighting with semantic coloring
- Real-time error detection for invalid TOML syntax
- Document formatting for TOML files
- JSON Schema-based completion and validation for associated TOML files
- Hover documentation for recognized keys
- Auto-completion for known TOML schemas
- TOML formatting, folding, navigation, and refactoring
What you don't get:
- YAML file editing (stays inactive for YAML files)
- Conversion between TOML and YAML formats
- Preview or visualization features
Common TOML + YAML workflows:
When this is best:
If you work with Rust or Python projects that also contain deployment or CI YAML, this extension fills the TOML side of the repository. Skip it when you edit YAML only.
Its schema features apply to TOML documents. Red Hat YAML remains responsible for .yaml and .yml files.
7. Error Lens (Best for Inline Error Display)
Error Lens displays diagnostics beside the affected code. This makes many messages readable without repeatedly opening the Problems panel.
Install via command line: code --install-extension usernamehw.errorlens or search "Error Lens" in Extensions panel.
What you get:
- Inline error messages at the end of problematic lines
- Color-coded highlighting (red for errors, yellow for warnings, blue for info)
- Configurable message positioning and styling
- Displays diagnostics produced by enabled language tools
- Real-time updates as you type
- Status bar showing total error/warning count
- Gutter icons indicating line severity
What you don't get:
- Any validation capabilities (displays errors from other extensions)
- Auto-fix or correction features
- YAML-specific functionality
Workflow comparison:
When this is best:
Choose Error Lens when you want diagnostics visible in the editor rather than collected only in the Problems panel. It is particularly useful in workspaces where several language tools report errors and warnings.
When to skip:
Skip it if inline messages make the editor feel crowded or you already rely on the Problems panel. Error Lens only displays diagnostics from tools such as Red Hat YAML; it does not validate YAML itself.
Extension Comparison Table
Which Extension Should You Actually Use?
Start with Red Hat YAML for validation, completion, and formatting. Add Kubernetes only if you need to browse clusters, apply manifests, inspect logs, or forward ports from VS Code.
The remaining extensions solve narrower problems. Use indent-rainbow for visual indentation, Error Lens for inline diagnostics, YAML Sort for controlled key ordering, and Prettier when YAML should follow an existing project-wide formatting setup. Install Even Better TOML only when the same repository also contains TOML files.
Quick Picks for VS Code YAML Extensions
Common YAML Issues These Extensions Solve
Schema validation errors: When the correct schema is associated, Red Hat YAML can report missing fields, invalid keys, and incorrect value types. Hover over an underlined problem to read its diagnostic or schema description.
Indentation mistakes: indent-rainbow assigns a different color to each indentation level, making unusual spacing easier to see.
Kubernetes manifest workflow: Red Hat YAML can validate manifests against a selected Kubernetes schema. Kubernetes Tools adds commands for applying resources, viewing diffs, reading logs, and working with the active cluster.
Inconsistent team formatting: Prettier applies shared formatting rules, while YAML Sort controls key order. Choose the one that matches the problem instead of making both modify every save.
Hard-to-spot diagnostics: Error Lens displays messages beside the affected line, reducing trips to the Problems panel.
Missing field documentation: Red Hat YAML can show schema descriptions when you hover over recognized properties.
VS Code Settings for YAML Editing
These settings.json values provide a practical starting point:
Enable format on save only after checking that the formatter matches the repository's existing style. Otherwise, a simple edit can produce an unnecessarily large diff.
Frequently Asked Questions
What's the best YAML extension for VS Code?
YAML by Red Hat is the best default. It provides validation, schema-based completion, hover information, formatting, and document outlining. SchemaStore recognizes many common formats; custom formats need an explicit schema association.
How do I enable YAML validation in VS Code?
Install YAML by Red Hat from the Extensions panel. Validation activates for recognized formats; custom schemas require a mapping in settings.json:
"yaml.schemas": {
"path/to/schema.json": "*.yaml"
}Matching files are then validated as you type.
Does VS Code support Kubernetes YAML auto-completion?
Yes. Associate the Kubernetes schema through Red Hat YAML, then press Ctrl + Space for schema-based suggestions. Use yaml.kubernetesVersion to target a specific version. Add Kubernetes Tools only if you also need cluster browsing, logs, apply, diff, or port-forwarding commands.
How do I format YAML files in VS Code?
Install YAML by Red Hat and run "Format Document" from the Command Palette. Enable format on save in settings.json:
"editor.formatOnSave": true,
"[yaml]": {
"editor.defaultFormatter": "redhat.vscode-yaml"
}This formats YAML whenever you save. Set "editor.tabSize": 2 inside the [yaml] section if the project uses two-space indentation.
What's the difference between Red Hat YAML and YAML Language Support?
They usually refer to the same extension. Its Marketplace title is "YAML Language Support by Red Hat," and its ID is redhat.vscode-yaml.
How do I add custom YAML schema validation in VS Code?
Install Red Hat YAML extension. Add schema mapping to settings.json:
"yaml.schemas": {
"https://example.com/schema.json": "config/*.yaml"
}The key can be a remote schema URL or a local path. The glob determines which files use that schema. SchemaStore supplies mappings for many common formats, but its catalog changes over time.
Related Reading
For general YAML editing across platforms, check the best YAML editors for Windows and best YAML editors for Linux guides.
Using Notepad instead? See the best YAML plugins for Notepad guide.
Editor-specific guides:
- Best JSON extensions for VS Code for JSON editing in VS Code
- Best XML extensions for VS Code for XML workflow optimization
Read More
All Articles5 Best YAML Editors for Home Assistant in 2026 (Config Editing)
Compare the best YAML editors for Home Assistant, including Studio Code Server, Config Helper, File Editor, Notepad++, and Vim for configuration.yaml.
8 Best YAML Editors for Linux in 2026 (GUI & Terminal)
Compare 8 best YAML editors for Linux including VS Code, Kate, Vim, yamllint, and GUI tools. Covers terminal and desktop options for Ubuntu, Fedora, and Arch Linux users.
7 Best YAML Editors for Mac in 2026 (Free & Paid)
Find the best YAML editor for macOS with validation and syntax highlighting. Compare VS Code, Sublime Text, BBEdit, and more for Kubernetes, Docker, and CI/CD configs.