round
Round a floating point number to the nearest integer or specified decimal places.
Syntax
{{ number | round: decimals }}Example
{% assign rating = 4.867 %}{{ rating | round: 1 }} StarsOutput
4.9 StarsThe round filter rounds floating point decimal numbers to the nearest whole integer or to a specified number of decimal places when an optional argument is supplied. It uses standard half-up arithmetic rounding.
In programmatic SEO directories, round formats review score averages and percentage discounts into clean, trustworthy badges. For example: {{ row.aggregate_rating | round: 1 }} out of 5 stars based on verified local customer reviews. This avoids displaying unformatted floating point decimals like 4.8666667, maintaining visual polish.
Filters
- abs
- append
- at_least
- at_most
- capitalize
- ceil
- compact
- concat
- date
- default
- divided_by
- downcase
- escape
- escape_once
- first
- floor
- join
- last
- lstrip
- map
- minus
- modulo
- newline_to_br
- plus
- prepend
- remove
- remove_first
- replace
- replace_first
- reverse
- round
- rstrip
- size
- slice
- sort
- sort_natural
- split
- strip
- strip_html
- strip_newlines
- times
- truncate
- truncatewords
- uniq
- upcase
- url_decode
- url_encode
- where
- raw
- slugify
- number_format
