---
title: '|truncatewords'
description: truncates a value to `n` words and appends an ellipsis (…).
date: '2026-08-02'
categories:
  - Filter
  - String
canonical: https://www.djangotemplatetagsandfilters.com/filters/truncatewords/
doc_link: https://docs.djangoproject.com/en/6.0/ref/templates/builtins/#truncatewords
---

# |truncatewords

truncates a value to `n` words and appends an ellipsis (…).

## Documentation

Truncates a value to `n` words and appends an ellipsis (…).

### Variable

```django
blurb_text = 'You are pretty smart!'
```

### Template

```django
{{ blurb_text|truncatewords:3 }}
```

### Result

```django
You are pretty…
```

## Commentary

You should not use the `truncatewords` filter on HTML pages. Use [`truncatewords_html`](/filters/truncatewords_html/) instead.

See also:

- [`truncatechars`](/filters/truncatechars/)
- [`truncatechars_html`](/filters/truncatechars_html/)
- [`truncatewords`](/filters/truncatewords/)
- [`truncatewords_html`](/filters/truncatewords_html/)
