Tools

Home
JSON FormatterSQL FormatterJS ValidatorMinify CSS
Merge PDFCompress PDFImage to PDF
JPG to PNGPNG to WebPCrop Image

XAML Code Prettifier & Indenter

Paste minified or messy XAML markup, instantly format with proper indentation and attribute highlighting

Your files never leave your browser
Input0 chars, 0 lines
Output0 chars, 0 lines
Ready·

XML (Extensible Markup Language) is a markup language designed to store and transport data. Unlike HTML, XML tags are not predefined — you define your own tags to describe the data structure. XML is widely used in web services (SOAP), configuration files, document formats (DOCX, SVG), and data interchange between different systems.

Paste messy or minified WPF, UWP, or .NET MAUI markup and get clean, indented XAML back instantly. Pick 2-space or 4-space indentation, hit Format, and the nesting structure becomes readable again — or switch to Minify when you need everything on one line.

Attributes, binding expressions, and xmlns declarations stay exactly as you wrote them. Only whitespace changes. And everything runs in your browser. Nothing gets uploaded.

How It Works

Paste XAML
→
Parse & Indent
→
Formatted Output

The formatter tokenizes your XAML into opening tags, closing tags, self-closing elements, comments, and CDATA blocks. It walks through each token, tracking nesting depth with a stack. Every opening tag increases the indent level; every closing tag decreases it. Self-closing tags stay at the current level. Attributes and namespaces are preserved exactly — only whitespace changes.

Examples

Minified WPF Button

Someone exported a Window and everything collapsed to one line.

INPUT
<Button Content="Save" Width="120" Height="36" Margin="10" Click="OnSave"/>
OUTPUT
<Button Content="Save" Width="120" Height="36" Margin="10" Click="OnSave" />

Nested Grid with StackPanel

A typical layout where three levels of nesting got flattened during a merge conflict resolution.

INPUT
<Grid><Grid.RowDefinitions><RowDefinition Height="Auto"/><RowDefinition Height="*"/></Grid.RowDefinitions><StackPanel Grid.Row="0"><TextBlock Text="Header"/></StackPanel><ListView Grid.Row="1" ItemsSource="{Binding Items}"/></Grid>
OUTPUT
<Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <StackPanel Grid.Row="0"> <TextBlock Text="Header" /> </StackPanel> <ListView Grid.Row="1" ItemsSource="{Binding Items}" /> </Grid>

MAUI ContentPage with Data Binding

Grabbed from a .NET MAUI tutorial — the xmlns declarations and binding expressions need to stay intact while the structure gets readable indentation.

INPUT
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="MyApp.MainPage"><VerticalStackLayout><Label Text="{Binding UserName}" FontSize="24"/><Entry Placeholder="Enter name" Text="{Binding UserName, Mode=TwoWay}"/><Button Text="Submit" Command="{Binding SubmitCommand}"/></VerticalStackLayout></ContentPage>
OUTPUT
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="MyApp.MainPage"> <VerticalStackLayout> <Label Text="{Binding UserName}" FontSize="24" /> <Entry Placeholder="Enter name" Text="{Binding UserName, Mode=TwoWay}" /> <Button Text="Submit" Command="{Binding SubmitCommand}" /> </VerticalStackLayout> </ContentPage>

Who Uses This

👨‍💻 WPF Developers

Cleaning up auto-generated XAML from Visual Studio designers before committing to source control.

📱 .NET MAUI Developers

Reformatting cross-platform UI markup after copying snippets from docs or Stack Overflow.

👩‍🏫 Instructors

Making XAML samples readable for students who are still learning the tag hierarchy.

🔍 Code Reviewers

Quickly prettifying a diff to check whether a PR changes structure or just reshuffles attributes.

Common Mistakes

Pasting invalid XML

If a closing tag is missing or an angle bracket is unescaped, the formatter can't build the tree. Fix the broken tag first, then format. The error message will usually point to the exact line.

Expecting attribute reordering

This tool only fixes indentation and line breaks. It won't alphabetize your attributes or move xmlns declarations to the top. That's by design — reordering attributes can break tooling that depends on attribute order.

Formatting XAML with embedded C# code-behind

If you accidentally paste your .xaml.cs content mixed with the XAML markup, the parser will choke on the C# syntax. Make sure you're only pasting the .xaml file content.

Technical Details

Frequently Asked Questions

What is a XAML formatter?

A XAML formatter takes messy or minified XAML markup and adds proper indentation and line breaks so you can actually read it. Think of it like a code beautifier, but specifically built for the XML-based UI language used in WPF, UWP, and .NET MAUI apps.

Does this work with WPF and .NET MAUI XAML?

Yes. It handles any well-formed XAML regardless of the framework. WPF, UWP, Xamarin.Forms, .NET MAUI, even Silverlight if you still have that lying around. The formatter treats XAML as structured XML, so framework-specific tags don't matter.

Will formatting change my binding expressions?

No. Binding expressions like {Binding Path=Name, Mode=TwoWay} and markup extensions stay exactly as you wrote them. The formatter only touches whitespace outside of attribute values. Your bindings, converters, and static resources won't be modified.

How do I minify XAML?

Paste your XAML and click the Minify button instead of Format. It strips all unnecessary whitespace and puts everything on one line. Useful for embedding XAML strings in code or reducing file size in resource dictionaries.

Is my XAML code safe when I paste it here?

Completely. Everything runs in your browser with JavaScript — no server involved. Your XAML is never transmitted anywhere. You can disconnect from the internet and the tool keeps working. Check your browser's network tab if you want proof.

Share: