---
title: '|divisibleby'
description: returns `True` if the value is divisible by `n`.
date: '2026-08-02'
categories:
  - Filter
  - Number
canonical: https://coolify.djangotemplatetagsandfilters.com/filters/divisibleby/
doc_link: https://docs.djangoproject.com/en/6.0/ref/templates/builtins/#divisibleby
---

# |divisibleby

returns `True` if the value is divisible by `n`.

## Documentation

Returns `True` if the value is divisible by `n`, and `False` otherwise.

### Variable

```django
age = 33
```

### Template

```django
{{ age|divisibleby:2 }} {{ age|divisibleby:3 }}
```

### Result

```django
False True
```

## Commentary

This Django template filter is similar to mod / modulus. It is useful for creating columns when using Bootstrap or some similar library.

### Example Code:

```django
<div class="row">
  {% for item in items %}
    <div class="col-4">
      {{ item }}
    </div>
    {% if forloop.counter|divisibleby:3 %}
      {# Start new row #}
      </div>
      <div class="row">
    {% endif %}
  {% endfor %}
</div>
```
