---
title: "What is Twig?"
term: "Twig"
description: "Twig is a free and open-source template engine for PHP, maintained by the Symfony project, that lets developers write HTML templates with a concise syntax for variables, loops, conditions and template inheritance."
url: "https://glossary.io/twig/"
published: "2026-11-22T20:46:19.929Z"
updated: "2026-11-22T20:46:19.929Z"
topics:
  - "Web development"
wikidata: "https://www.wikidata.org/wiki/Q4051886"
---

# What is Twig?

**Definition:** Twig is a free and open-source template engine for PHP, maintained by the Symfony project, that lets developers write HTML templates with a concise syntax for variables, loops, conditions and template inheritance.

Twig's syntax was inspired by the Jinja and Django template languages, using double curly braces to print values and tags for logic. Templates are compiled to optimized [PHP](https://glossary.io/php/) code, and output is escaped automatically by default, which helps prevent [cross-site scripting](https://glossary.io/cross-site-scripting/) vulnerabilities.

Twig is the default template engine in the Symfony framework and is used by content management systems including Drupal, Craft CMS and [Grav](https://glossary.io/grav/), helping keep presentation code separate from application logic.

## Twig resources

- [Official website](https://twig.symfony.com/)
- [Twig on Wikipedia](https://en.wikipedia.org/wiki/Twig_%28template_engine%29)

## Related terms

- [Grav](https://glossary.io/grav/)
- [cross-site scripting](https://glossary.io/cross-site-scripting/)
- [PHP](https://glossary.io/php/)

**Topic:** [Web development](https://glossary.io/topics/web-development/)

## Cite this definition

- APA: What is Twig? (2026, November 22). Glossary. https://glossary.io/twig/
- MLA: “What Is Twig?” Glossary, Coywolf, 22 Nov. 2026, glossary.io/twig/.
- Chicago: “What Is Twig?” Glossary. Coywolf. November 22, 2026. https://glossary.io/twig/.

Published November 22, 2026.
