Filters are functions that modify the output of your Liquid objects. You can use them to format text, manipulate numbers and arrays, and work with dates. Syntax: {{ variable | filter_name: argument1, argument2 }}

String Filters

These filters help you manipulate text strings.
Filter & SyntaxDescriptionExample
upcaseConverts a string to uppercase.{{ "hello" | upcase }}HELLO
downcaseConverts a string to lowercase.{{ "HELLO" | downcase }}hello
capitalizeCapitalizes the first word of a string.{{ "hello world" | capitalize }}Hello world
truncate: numShortens a string to num characters.{{ "Hello world" | truncate: 8 }}Hello...
split: "char"Splits a string into an array on a character.{{ "a,b,c" | split: "," }}["a","b","c"]
append: "str"Adds a string to the end.{{ "hello" | append: " world" }}hello world
prepend: "str"Adds a string to the beginning.{{ "world" | prepend: "hello " }}hello world
remove: "str"Removes all occurrences of a substring.{{ "hello world" | remove: "l" }}heo word
replace: "a", "b"Replaces all occurrences of string “a” with “b”.{{ "hi hi" | replace: "hi", "bye" }}bye bye
escapeEscapes a string for use in HTML.{{ "<p>text</p>" | escape }}&lt;p&gt;text&lt;/p&gt;

Number Filters

These filters perform mathematical operations.
Filter & SyntaxDescriptionExample
plus: numAdds a number.{{ 5 | plus: 3 }}8
minus: numSubtracts a number.{{ 5 | minus: 3 }}2
times: numMultiplies by a number.{{ 5 | times: 3 }}15
divided_by: numDivides by a number.{{ 15 | divided_by: 3 }}5
round: digitsRounds to the nearest integer or specified decimal places.{{ 4.56 | round }}5
ceilRounds up to the nearest integer.{{ 4.1 | ceil }}5
floorRounds down to the nearest integer.{{ 4.9 | floor }}4

Array Filters

These filters help you work with lists of items.
Filter & SyntaxDescriptionExample
sizeReturns the number of items in an array.{{ [1,2,3] | size }}3
firstReturns the first item of an array.{{ ["a","b"] | first }}a
lastReturns the last item of an array.{{ ["a","b"] | last }}b
join: "char"Joins array elements with a character.{{ ["a","b"] | join: ", " }}a, b
sort: "key"Sorts an array. Can sort an array of objects by a key.{{ [3,1,2] | sort }}[1,2,3]
uniqRemoves duplicate elements from an array.{{ [1,2,2,3] | uniq }}[1,2,3]
map: "key"Creates an array of values by extracting a key from objects.{{ users | map: "name" }}["Alice", "Bob"]

Date Filters (Custom)

These are powerful custom filters for parsing, formatting, and checking date/time values.

carbon_date

This filter parses a date string and reformats it. It can understand many common date formats automatically. Syntax: {{ date_string | carbon_date: "output_format" }}
{{ "2025-12-25T10:30:00Z" | carbon_date: "F j, Y" }}
Common Format Codes:
CodeDescriptionExample
YFour-digit year2025
mMonth (01-12)12
dDay (01-31)25
HHour (00-23)10
iMinute (00-59)30
sSecond (00-59)00
FFull month nameDecember
MShort month nameDec
lFull day of weekThursday
DShort day of weekThu
cISO 8601 format2025-12-25T10:30:00+00:00

carbon_condition

This filter checks if a date meets a specific condition relative to the current time. It returns true or false, making it perfect for use in if tags. Syntax: {{ date_string | carbon_condition: "condition_name" }}
{% if subscription.expires_at | carbon_condition: "is_past" %}
  Your subscription has expired.
{% endif %}
Available Conditions:
ConditionDescription
is_todayIs the date today?
is_tomorrowIs the date tomorrow?
is_yesterdayWas the date yesterday?
is_futureIs the date in the future?
is_pastIs the date in the past?
is_weekendIs the date on a weekend?
is_weekdayIs the date on a weekday?
in_7_daysIs the date exactly 7 days from now?
within_14_daysIs the date between now and 14 days from now?
before_30_daysIs the date before 30 days from now?
older_than_90_daysIs the date more than 90 days in the past?
newer_than_3_daysIs the date within the last 3 days?
after_5_daysIs the date more than 5 days in the future?
exactly_1_dayIs the date exactly 1 day from now? (Same as is_tomorrow)
For conditions like in_X_days, you can use singular or plural (e.g., in_1_day works too).