Skip to Content
Sindre Sorhus
Back to Actions

Updated

How to Filter a List in Shortcuts on iPhone and Mac

By Sindre Sorhus, who makes the Actions app

With Actions

  1. Install Actions, and open it once.
  2. In your shortcut, add the “Filter List” action below the action that makes the list, and select the list in the action.
  3. Choose “Keep” to keep the items that match, or “Remove” to remove them.
  4. Choose the condition: “contains”, “begins with”, “ends with”, “is”, or “matches regex”. Then type the text.

The result is “Filtered List”, in the same order as the list. Upper and lower case do not matter, unless you turn on “Case Sensitive”. To keep only the first matches, turn on “Limit”.

Tips

  • The action is for a list of text and numbers. For a list of dictionaries, like the result of a JSON API, use “Filter List of Dictionaries”.
  • If Shortcuts says that it “couldn’t convert from Text to NSString”, change the preview of the result to the list view. This is a bug in the Shortcuts app.
  • To remove the items that are in the list two times, use “Remove Duplicates from List”.

Get Actions

Additional actions for the Shortcuts app

Download on the App Store

Free

Requires
macOS, iOS, or visionOS 26 or later
Updated
June 2026
US App Store rating
4.8/5 (703 ratings)

More about Actions

Without an app

The “Filter” actions of Shortcuts, like “Filter Files”, are only for files, photos, and other content, not for a list of text. Use a loop:

  1. Add the “Repeat with Each” action, and select the list.
  2. In the loop, add an “If” action. Use “Repeat Item” as the input, choose a condition, like “contains”, and type the text.
  3. In the “If” part, add the “Add to Variable” action with “Repeat Item”, and name the variable, like “Filtered”.
  4. After “End Repeat”, use the variable.

This works, but it is three actions for each filter, and “If” has no condition for a regular expression. For a regular expression, combine the list with “Combine Text”, and use “Match Text”.