---
title: '|floatformat'
description: rounds a float to `n` decimal places.
date: '2026-08-02'
categories:
  - Filter
  - Number
canonical: https://www.djangotemplatetagsandfilters.com/filters/floatformat/
doc_link: https://docs.djangoproject.com/en/6.0/ref/templates/builtins/#floatformat
---

# |floatformat

rounds a float to `n` decimal places.

## Documentation

The `floatformat` filter takes an `n` argument for the number of decimal places to round to. Without that argument, it will round to one decimal place unless the decimal value is `0`, in which case it will just output the integer.

| filter | 1000.0 | 1000.11 | 3.14159 |
| --- | --- | --- | --- |
| `{{ i|floatformat }}` | 1000 | 1000.1 | 3.1 |
| `{{ i|floatformat:2 }}` | 1000.00 | 1000.11 | 3.14 |
| `{{ i|floatformat:0 }}` | 1000 | 1000 | 3 |
