--- title: "Liquid filters: size" description: Returns the size of a string or array. api_name: liquid source_url: html: https://shopify.dev/docs/api/liquid/filters/size md: https://shopify.dev/docs/api/liquid/filters/size.md --- # size ```oobleck variable | size ``` returns [number](https://shopify.dev/docs/api/liquid/basics#number) Returns the size of a string or array. The size of a string is the number of characters that the string includes. The size of an array is the number of items in the array. ```liquid {{ collection.title | size }} {{ collection.products | size }} ``` ##### Code ``` {{ collection.title | size }} {{ collection.products | size }} ``` ##### Data ``` { "collection": { "products": [], "title": "Sale potions" } } ``` ## Output ```html 12 4 ``` ### Dot notation You can use the `size` filter with dot notation when you need to use it inside a tag or object output. ```liquid {% if collection.products.size >= 10 %} There are 10 or more products in this collection. {% else %} There are less than 10 products in this collection. {% endif %} ``` ##### Code ``` {% if collection.products.size >= 10 %} There are 10 or more products in this collection. {% else %} There are less than 10 products in this collection. {% endif %} ``` ##### Data ``` { "collection": { "products": [] } } ``` ## Output ```html There are less than 10 products in this collection. ```