Power Automate Split Function Syntax, Uses, and Examples

Formulas & functions · Updated November 22, 2026

In Power Automate, use split(text, delimiter) to divide a string wherever the delimiter occurs; the result is an array of text values. For example, split('red,green,blue', ',') returns ["red","green","blue"]. In a flow expression, enter the function without a leading equals sign.

Power Automate split function syntax

The function takes two arguments, in this order: the string to divide and the delimiter that marks each boundary. The delimiter is a string, not a regular expression, and it can be more than one character long. The basic pattern is:

split(string, delimiter)

For instance, split('North|South|West', '|') divides the text at each vertical bar. The delimiter itself is not included in the resulting items. The function returns an array, even when the original text contains only one item, so a result may need to be handled differently from an ordinary string.

In Power Automate cloud flows, expressions are entered through the Expression tab in the designer. In the current expression editor, type the function without an initial @. The workflow definition format may show expressions with a leading @, such as @split('a,b', ','); that notation is for the underlying definition, not usually what you type into the expression editor. If you insert an expression into surrounding text, the designer may represent it as an inline expression instead.

How split works with flow data

The first argument can be a literal string, a trigger value, an action output, or a variable. Dynamic content tokens are convenient when building a flow, but the equivalent expression makes the input and delimiter explicit. For example, if the incoming trigger has a text field named message, an expression can refer to it like this:

split(triggerBody()?['message'], ',')

The triggerBody() function reads the trigger’s body, and the property selector accesses the message field. The question mark in ?['message'] is safe navigation: it avoids a property-access failure if the value before it is null. It does not, by itself, turn a null value into an empty string. If a field may be null, handle that case deliberately, for example with split(coalesce(triggerBody()?['message'], ''), ',').

Another common source is a Compose action. If an earlier Compose action is named Compose, its output can be passed to split with split(outputs('Compose'), ','). Action names in expressions must match the flow’s internal action name. If you rename an action or use a name with spaces, let the designer insert the reference where possible, then check the expression it creates.

Examples for common delimiters

Here are practical examples of what the function does. Each expression returns an array:

  • Comma-separated labels: split('urgent,finance,review', ',') returns the three labels as separate values.
  • Line breaks: split(variables('Notes'), decodeUriComponent('%0A')) separates text at line-feed characters. Text copied from some systems may use carriage-return plus line-feed; inspect the actual input if line breaks remain attached to the items.
  • Multi-character separator: split('A--B--C', '--') returns A, B, and C. The delimiter can be a string such as --, not just a single character.
  • Text around a colon: split('ticket:4821', ':') returns two items. Use first(split('ticket:4821', ':')) to get the first item, or last(split('ticket:4821', ':')) to get the last.

Array indexes start at zero. For example, if the text is in a variable named RawText, split(variables('RawText'), '|')[0] selects the first item and index [1] selects the second. Indexing is useful when the format guarantees a fixed number and order of fields. If that format can vary, check the array length or use a loop rather than assuming an item exists.

Using the resulting array in a flow

To process every item, add an Apply to each control and provide it with the split expression’s array. Inside the loop, the current item is available as the loop’s item. For example, splitting a list of email addresses can create one iteration per address. If items might contain spaces around them, apply trim() to the current item before using it.

Use a Compose action when you want to inspect the array during flow design or make the expression easier to read. For example, put split(variables('RawText'), ';') in Compose, then select that action’s output as the input to Apply to each. A Compose action does not change the split result; it simply makes an intermediate value visible and reusable.

Sometimes the goal is one particular item rather than a loop. Use first() or last() when the desired position is clear, or use a zero-based index when the input format is dependable. Before relying on a fixed position, consider what happens when the source text is missing a delimiter or contains fewer fields than expected. A condition or a validation step can prevent a later action from failing on an absent item.

Whitespace, empty values, and delimiters

split() divides text at exact matches; it does not automatically trim whitespace, discard empty values, or interpret different separators as equivalent. For example, split('red, green', ',') produces a second item with a leading space. If the source has ordinary spaces around each value, trim each item as you process it. Trimming the whole source before splitting only removes whitespace at the beginning and end of the entire string, not whitespace around every item.

Adjacent delimiters and delimiters at the start or end of a string can create empty items. For example, a string like red,,blue, has an empty field between the two commas and an empty field after the final comma. An empty source string is another case worth checking: splitting it does not necessarily give the same result as an intentionally empty array. If empty input means there is nothing to process, add a condition before the loop or normalize the input explicitly.

Delimiter choice matters. Splitting on a space treats each individual space as a boundary, while splitting on a comma does not automatically account for a comma followed by a space as a different separator. If the data allows inconsistent spacing or multiple separators, normalize the input first or process each item with appropriate trimming and validation. Do not assume the function will infer the structure of the text.

Common problems and troubleshooting

  • The result appears as one value: Check that the delimiter matches the input exactly. A comma, semicolon, tab, and line break are different characters.
  • The expression reports a type error: The source field may be null or not a string. Use a suitable conversion such as string() for a value that can be converted, and use coalesce() when null needs a defined fallback.
  • A later action gets the wrong data: Remember that split returns an array. Use Apply to each for repeated processing, or select a specific element when the position is known.
  • Items include unexpected spaces: Split does not trim them. Trim each item where it is consumed.
  • An index fails: The input may contain fewer delimiters than expected. Check that the array has enough elements before accessing a fixed index.

When debugging, add a Compose action before or after the split and inspect the run history. Compare the actual source value with the delimiter, paying attention to invisible characters such as tabs and line endings. This is often more useful than changing the expression blindly, because text that looks like a comma or line break may have been encoded differently by the source system.

When split is not the right parser

A frequent misconception is that splitting on commas is a complete way to parse a CSV file. It is not. A valid CSV field can contain a comma inside quotation marks, and quotation marks can be escaped according to CSV rules. A basic split on , will divide at those commas too, producing incorrect columns. It also does not validate row lengths, quoting, or other parts of the file format.

For simple, controlled text where the separator cannot appear inside a value, split is a straightforward choice. For structured data, choose a method that understands the format: JSON data is usually better handled with a Parse JSON action, while CSV with quoted fields needs a CSV-aware parser or another suitable processing approach. Likewise, splitting a sentence on spaces is not a robust way to tokenize natural language because punctuation, repeated spaces, and language-specific rules can change the result.

Consider the source format before building a flow. If another system can send an array or structured JSON rather than a packed string, using that structured data directly can avoid separator and escaping problems. Split is most dependable when you control how the text is produced and can specify a clear, unambiguous delimiter.

Frequently Asked Questions

What is the syntax for split in Power Automate?
Use split(string, delimiter). The first argument is the text to divide, and the second is the exact separator. The return value is an array.

Does split return a string or an array?
It returns an array of strings. Use Apply to each to process every part, or select an item with first(), last(), or a zero-based index.

Can the delimiter contain more than one character?
Yes. A delimiter such as -- is treated as a complete separator string. Split does not treat it as a pattern or search expression.

How do I split text on a line break?
Use a line-feed delimiter such as decodeUriComponent('%0A'). If the source uses Windows-style carriage-return and line-feed characters, inspect a sample in run history and account for both characters where needed.

Does split remove spaces or empty items?
No. It splits at the specified delimiter but does not automatically trim whitespace or filter empty values. Trim or validate each item in the flow when the source can include them.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.