.erb File — Embedded Ruby Template
text/x-erb
Drop any file to identify its extension and type — runs entirely in your browser
Drop a .erb file here or click to choose
Or drop any file to identify its extension
text/x-erbQuick Facts
| Extension | .erb |
| Full Name | Embedded Ruby Template |
| MIME Type | text/x-erb |
| Category | Web |
| Type | Text-based (human-readable) |
| Typical Size | 1 KB – 20 KB |
| First Appeared | 2004 |
What Is a .erb File?
ERB (Embedded Ruby) is Ruby's standard template system, using <% %> tags to embed Ruby code within text files — most commonly HTML. ERB files use three tag types: <% %> for executing Ruby code (control flow), <%= %> for outputting evaluated expressions, and <%# %> for comments. ERB is the default template engine for Ruby on Rails, where it generates HTML views with dynamic content from controllers and models. In Rails, ERB templates follow naming conventions like index.html.erb (HTML format) or show.json.erb (JSON format). ERB works by compiling the template into Ruby code that builds an output string, making it extremely fast and allowing any Ruby expression within tags. The simplicity of ERB — it's just Ruby with output delimiters — means there's no new syntax to learn beyond Ruby itself. ERB is used beyond Rails in standalone Ruby scripts, configuration file generation (like Chef and Puppet templates), email templates, and any context where Ruby applications need to generate dynamic text output. While Rails also supports alternative template engines like Haml and Slim, ERB remains the most widely used due to its simplicity and HTML familiarity.
How to Open .erb Files
Related File Extensions
More Web File Extensions
Other web formats you might encounter
Browse File Extensions by Category
Explore our reference of 259 file extensions with details, programs, and related formats.