Skip to content

Rust Formatter

Embed

Paste this where you want Rust Formatter on your site. Adjust the height to fit.

<iframe src="https://www.browserutils.dev/embed/rust-formatter/" width="100%" height="500" frameborder="0" loading="lazy" title="Rust Formatter"></iframe>
<p style="font-size:12px;margin:4px 0 0"><a href="https://www.browserutils.dev/tools/rust-formatter/">Rust Formatter</a> by BrowserUtils</p>

Format Rust code with rustfmt-style indentation.Runs in this tab.

Next step

About Rust Formatter

Free online Rust formatter. Format Rust source code with 4-space indentation following rustfmt conventions for consistent, readable code. It runs in your browser. Nothing is sent to a server.

Questions

Does this follow rustfmt conventions?
Yes, the formatter uses 4-space indentation and same-line opening braces, following standard Rust formatting conventions.
Does it handle Rust-specific syntax?
Yes, the formatter handles impl blocks, trait definitions, match expressions, lifetime annotations, macros, and other Rust-specific constructs.
Can I format Rust code with macros like vec! and println!?
Yes, macro invocations are recognized and their contents are indented properly. Both function-like macros and declarative macro definitions are handled.
Does the Rust formatter work without installing the Rust toolchain?
Yes, this tool runs entirely in your browser. You do not need Rust, Cargo, or rustfmt installed to format Rust code here.

More in Formatters & Beautifiers

All 26 formatters & beautifiers