---
title: '{% spaceless %}'
description: removes irrelevant whitespace between HTML tags.
date: '2026-08-02'
categories:
  - Template Tag
  - Coding
canonical: https://coolify.djangotemplatetagsandfilters.com/tags/spaceless/
doc_link: https://docs.djangoproject.com/en/6.0/ref/templates/builtins/#spaceless
---

# {% spaceless %}

removes irrelevant whitespace between HTML tags.

## Documentation

Removes irrelevant whitespace between HTML tags.

### Template

```django
{% spaceless %}
<p>
  <small class="text-muted">
    Created on: {{ joke.created }}
    Last updated: {{ joke.updated }}
  </small>
</p>
{% endspaceless %}
```

### Result

```django
<p><small class="text-muted">
    Created on:
    Last updated:
  </small></p>
```

Notice that the whitespace within the `small` element has not been removed. Only whitespace between successive opening tags and successive closing tags is removed.
