Mustache / Handlebars Tester

Render a Mustache template against JSON data.

Open tool

Overview

Paste a Mustache or Handlebars template along with a JSON data context and the tester renders the final output. Supports the common tags - variables ({{name}}), sections ({{#items}}...{{/items}}), inverted sections ({{^items}}...{{/items}}), partials ({{> partial}}), and triple-stash ({{{html}}}) for unescaped output.

It's for developers working with Mustache/Handlebars templates - email templates, scaffolding generators, static site frameworks, dashboard widgets. Reach for it when sketching a template before wiring it into code, debugging a missing field, or testing whether your data shape produces the output you expect.

How it works

Mustache is "logic-less templates" - the spec is intentionally small. Handlebars extends Mustache with helpers ({{#if cond}}, {{#each items}}, custom block helpers). The tester implements the Mustache spec (the canonical reference for tag types and behaviour) plus the most-used Handlebars built-in helpers.

Variables are HTML-escaped by default; triple-stash ({{{var}}}) or {{&var}} outputs raw. Section behaviour depends on the value: arrays iterate, objects context-shift, falsy values skip the section.

Examples

  • Simple variable:
    Template: Hello, {{name}}!
    Data:     {"name":"world"}
    Output:   Hello, world!
    
  • Section over an array:
    Template: {{#items}}- {{.}}{{/items}}
    Data:     {"items":["a","b","c"]}
    Output:   - a- b- c
    
  • Inverted section (empty array):
    Template: {{^items}}None{{/items}}
    Data:     {"items":[]}
    Output:   None
    
  • Unescaped HTML:
    Template: {{{html}}}
    Data:     {"html":"<b>bold</b>"}
    Output:   <b>bold</b>
    

FAQ

Does it support Handlebars {{#if}} and {{#each}}?

Yes - the common Handlebars block helpers (if, unless, each, with) are recognised in addition to standard Mustache sections.

What about custom Handlebars helpers?

Custom helpers ({{myHelper arg}}) require JavaScript code registration in real Handlebars. The tester supports the built-in set; custom helpers won't resolve.

How are partials handled?

Partial includes ({{> name}}) need a partials registry. The tester accepts inline partial definitions in the data context for testing purposes.

Why is my HTML appearing as &lt;b&gt;?

You used {{var}} (escaped) instead of {{{var}}} (raw). Mustache escapes by default to prevent XSS - opt out only when you trust the content.

Try Mustache / Handlebars Tester

An unhandled error has occurred. Reload ×