# escape

Source: https://zotonic.com/docs/1461/escape

URI: https://zotonic.com/id/1461

Language: en



HTML escape a text. Escapes all reserved HTML characters in the value. Escaped strings are safe to be displayed in a HTML page. When you echo a query string argument or path variable then you must escape the value before displaying it on a HTML page.

The following characters are replaced:

| Character | Replacement |
| --------- | ----------- |
| `>`       | `&gt;`      |
| `<`       | `&lt;`      |
| `"`       | `&quot;`    |
| `'`       | `&#039;`    |
| `&`       | `&amp;`     |

The escaping is only applied if the filter is not within an `{% autoescape on %}` block. If you always want escaping to be applied, use the <a href="/id/doc_template_filter_filter_force_escape" class="doc-reference doc-reference-filter"><code>filter#force_escape</code></a> filter.

For example:

```django
{{ value|escape }}
```

When the value is `<hel&lo>` then the output is `&lt;hel&amp;lo&gt;`.

Note: this filter is not part of a module, it is built into the template compiler.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1461?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/1461?language=en>)
