ERB Beautify / Minify
Format ERB templates with clean HTML indentation and sensible spacing around Ruby tags. Handles <%= %> output tags, <% %> control flow, comments, and the HTML structure around them. Works with Rails views, partials, layouts, and any ERB template.

What it does
- ▸Beautifies ERB with proper HTML indentation around Ruby tags
- ▸Handles <%= %>, <% %>, <%# %> (comment), and <%- -%> (trim) tags
- ▸Preserves Ruby code inside tags without reformatting it
- ▸Formats multi-line Ruby blocks and if/else structures
- ▸Minify mode for compact output
Use cases
- ▸Formatting a Rails view that's grown messy over time
- ▸Cleaning up ERB partials before a code review
- ▸Making a complex layout file readable
- ▸Standardizing ERB formatting across a Rails project
How it works
Paste your ERB template into the input pane
Choose beautify or minify mode
Set indent style if beautifying
Copy the formatted ERB from the output pane
Frequently asked questions
1Does it format the Ruby code inside the tags?
The formatter focuses on the HTML structure and tag placement. Ruby code inside <% %> tags is preserved as-is to avoid changing logic. Use RuboCop in your editor for Ruby formatting.
2Does it handle Haml or Slim?
No. This formatter is specifically for ERB. Haml and Slim have their own indentation-based syntax that requires dedicated formatters.
3Will it break my Rails partials with locals?
No. The formatter only changes whitespace and indentation. It doesn't modify Ruby code, variable names, or tag structure, so partials with locals work exactly as before.
Related tools
Use ERB Beautify / Minify offline in Devinity
All 95 tools run locally on your Mac. No internet required, no data sent to servers.
Download Devinity →


