.erb
🌐 WebText-based

.erb File — Embedded Ruby Template

text/x-erb

File Inspector

Drop any file to identify its extension and type — runs entirely in your browser

ERB

Drop a .erb file here or click to choose

Or drop any file to identify its extension

Expected MIME type:text/x-erb

Quick Facts

Extension.erb
Full NameEmbedded Ruby Template
MIME Typetext/x-erb
CategoryWeb
TypeText-based (human-readable)
Typical Size1 KB – 20 KB
First Appeared2004

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

VS Code
RubyMine
Sublime Text
vim
any text editor

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.