---
title: '|length_is'
description: '**Deprecated.** Use `length` with comparison instead.'
date: '2025-12-04'
categories:
  - Filter
  - Logic
canonical: https://www.djangotemplatetagsandfilters.com/filters/length_is/
deprecated_in_version: '4.2'
doc_link: https://docs.djangoproject.com/en/6.0/ref/templates/builtins/#length-is
---

# |length_is

**Deprecated.** Use `length` with comparison instead.

## Documentation

> #### Deprecated in Django 4.2
> The `length_is` filter is deprecated. Use the [`length`](/filters/length/) filter with a comparison operator instead:
> ```django
> {% if value|length == 3 %}...{% endif %}
> ```

Returns `True` if the length of the value is `n`. Otherwise, it returns `False`.

This is most useful in a condition.

#### Variable

```django
veggies = ['Tomatoes', 'Cucumbers', 'Peas']
```

#### Template

```django
{% if veggies|length_is:3 %}
  <p>Looks like a trio of veggies tonight!</p>
{% endif %}
```

#### Result

```django
<p>Looks like a trio of veggies tonight!</p>
```

## Commentary

Maybe we are missing something, isn't using the [`length`](/filters/length/) filter just as easy?

```django
{% if veggies|length == 3 %}
  <p>Looks like a trio of veggies tonight!</p>
{% endif %}
```
