XAML Beautifier
Format XAML layouts for WPF, MAUI, WinUI, and Avalonia.
XAML Beautifier – Format XAML Layouts
XAML describes user interfaces in WPF, UWP, WinUI 3, .NET MAUI, Xamarin.Forms, and Avalonia. Deeply nested layouts — a Grid inside a StackPanel inside a ScrollViewer — become hard to follow when indentation is inconsistent. The XAML beautifier formats the markup so every element sits at the right depth.
What it formats
- Panels such as
Grid,StackPanel,DockPanel, and their children. - Property elements like
<Grid.RowDefinitions>and<DataGrid.Columns>. - Resource dictionaries, styles, templates, and triggers.
- Namespace declarations (
xmlns:x,xmlns:local) andx:Class,x:Nameattributes.
Markup extensions in attribute values — {Binding Orders}, {StaticResource AccentBrush}, {x:Static} — are left exactly as written, including their spacing and StringFormat parameters.
Indentation
Visual Studio formats XAML with 4 spaces by default, so that is the default here as well. You can switch to 2 spaces or tabs to match your .editorconfig.
Validation
XAML must be well-formed XML. Unclosed elements, duplicate attributes, or unescaped characters are reported with the line and column, which is helpful when editing XAML outside Visual Studio or Rider.
Typical uses
Clean up XAML pasted from Stack Overflow answers or documentation, normalize files generated by designers such as Blend, review UI changes in pull requests, or quickly read a layout when you are not in your IDE. Consistent indentation also makes it far easier to spot a control placed in the wrong Grid.Row or a style defined in the wrong resource dictionary, because the nesting of every element becomes visible.
Related tools
Format the C# code-behind with the C# Beautifier, minify XML resources with the XML Minifier, or format other XML documents with the XML Beautifier.
Frequently Asked Questions
Does it support .NET MAUI and Avalonia XAML?
Yes. All XAML dialects are XML, so any well-formed XAML file is formatted regardless of the UI framework.
Are bindings and markup extensions changed?
No. Attribute values, including {Binding ...} and {StaticResource ...} expressions, are kept exactly as written.
Can it put each attribute on its own line?
Not currently. Attributes stay on the element's line in their original order; only element nesting and indentation are formatted.