ERB review
A free Ruby library for evaluating template tags and generating strings.
Reviewed by iTechGuides Editors · Editorial team · Updated Oct 2026
ERB is a template processor included in Ruby’s standard library. It takes plain-text templates with Ruby expression tags, executable code, and comments, then evaluates the resulting Ruby code to produce a string. That makes it a fit for Ruby developers who want to generate text from templates within Ruby applications or scripts, including plain text and HTML. It is a developer library, not a hosted service.
The central capability is embedding Ruby directly in a template. A supplied binding lets a template access local variables and constants, while templates can also define methods, modules, and classes. This gives ERB a code-generation syntax model and room for logic beyond simple value insertion. It also means ERB is best suited to teams already comfortable placing executable Ruby in templates; developers seeking a language-neutral or strictly declarative template format should consider a different engine.
ERB is free and open source, and is distributed under Ruby’s free-software licensing terms. It is self-hosted as part of the Ruby development environment rather than offered as a hosted service. Encoding controls and configurable whitespace trimming address output-formatting needs, but ERB’s focus remains Ruby template processing. Choose it when Ruby integration and direct access to Ruby values matter more than a broad cross-language feature set; look elsewhere if the project needs a hosted workflow or templates independent of Ruby.
ERB pros and cons
- Where it wins
- Processes Ruby expressions, executable code, and comment tags in templates
- Bindings expose local variables and constants to templates
- Supports encoding settings and configurable whitespace trimming
- Where it doesn't
- Focused on Ruby rather than templates for other programming languages
- Templates can execute Ruby code, so they are not just declarative markup
- A developer library, not a hosted template service
ERB fact sheet, pricing and score →
Advertiser disclosure: iTechGuides is reader-supported. Vendors can pay for top positions in our rankings and for a place on other products' pages, and we may earn a commission when you click some links. Bought places stand at the number bought; this page and our disclosure say so. Paying vendors may get a fuller, more detailed review from our editors, and that review can change their score. How we rank.
Last updated · How we research and update