|floatformat Filter

rounds a float to n decimal places.

Number Most Useful As Markdown

Argument
n (optional) – the number of decimal places to round to.

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

More Number Filters

All Number Filters


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

Send Feedback

Official Documentation
This page last updated on August 2, 2026