|pluralize Filter

returns a pluralization suffix.

String Most Useful As Markdown

Argument
suffix (optional) – the suffix to use for pluralization. Default is s.

Documentation

If the value is not 1, '1', or an object of length 1, the pluralize filter outputs an “s” or the value of the suffix argument if one is used.

Variable

classes = {
    'Python': [
        'Intro Python', 'Advanced Python', 'Data Science', 'Django'
    ],
    'Databases': [
        'Intro PostgreSQL', 'Intro MySQL', 'Intro SQL Server', 'Intro Oracle'
    ],
    'Web': [
        'HTML', 'CSS', 'JavaScript'
    ],
    'XML': [
        'Intro XML'
    ]
}

Template

<ol>
  {% for category, titles in classes.items %}
    <li>
      {{ category }}: {{ titles|length }}
      class{{ titles|pluralize:"es" }}
    </li>
  {% endfor %}
</ol>

Result

<ol>
  <li>Python: 4 classes</li>
  <li>Databases: 4 classes</li>
  <li>Web: 3 classes</li>
  <li>XML: 1 class</li>
</ol>

Commentary

Super useful. Much easier and cleaner than using conditional expressions to decide when to pluralize a word.

More String Filters

All String Filters


Did we get something wrong? Is there a use case for the pluralize filter that we should add? Please let us know.

Send Feedback

Official Documentation
This page last updated on August 2, 2026