abs

Return the absolute value of a number, discarding any negative signs to produce a non-negative number.

Syntax

{{ number | abs }}

Example

{% assign delta = -25 %}{{ delta | abs }} points difference

Output

25 points difference

The abs filter returns the absolute mathematical value of a number, stripping any negative sign. If the input is positive or zero, it returns the number unchanged, ensuring clean numerical presentation.

On programmatic SEO landing pages, abs is useful when displaying price variances between local rates and national averages. For example: {% assign gap = row.local_price | minus: row.national_avg %}{{ gap | abs }} difference. This renders clear comparison metrics without negative symbols in copy.

Try this syntax in the editor.