---
title: '|safeseq'
description: applies the `safe` filter to each element of a sequence.
date: '2026-08-02'
categories:
  - Filter
  - Data Structure
canonical: https://coolify.djangotemplatetagsandfilters.com/filters/safeseq/
doc_link: https://docs.djangoproject.com/en/6.0/ref/templates/builtins/#safeseq
---

# |safeseq

applies the `safe` filter to each element of a sequence.

## Documentation

Applies the [`safe`](/filters/safe/) filter to each element of a sequence.

### Variable

```django
poem_lines = [
    'Much to his Mum and Dad’s dismay,',
    'Horace ate himself one day.',
    'He didn’t stop to say his grace,',
    'He just sat down and ate his face.',
    '“We can’t have this!” His Dad declared,',
    '“If that lad’s ate, he should be shared.”'
]
```

### Template

```django
{{ poem_lines|safeseq|join:'<br>' }}
```

### Result

```django
Much to his Mum and Dad’s <em>dismay</em>,<br>Horace <strong>ate himself</strong> one day.<br>He <em>didn’t stop</em> to say his grace,<br>He just sat down and <strong>ate his face</strong>.<br><em>“We can’t have this!”</em> His Dad declared,<br>“If that lad’s ate, <strong>he should be shared</strong>.”
```

And the output to the browser looks like this:

Much to his Mum and Dad’s *dismay*,  
Horace **ate himself** one day.  
He *didn’t stop* to say his grace,  
He just sat down and **ate his face**.  
*“We can’t have this!”* His Dad declared,  
“If that lad’s ate, **he should be shared**.”
