n8n Sort nodeConfigure Sort in n8n.
The Sort node reorders the items flowing through a workflow before anything downstream reads them. A single parameter drives it, Type, with 3 ways to order a list. The n8n Sort node ships with n8n at version 1, so there is nothing to install and no account to connect.
Verified Trustpilot reviews · AI, automation & growth agency
What does the n8n Sort node actually do?
Sort takes the list of items it receives and hands the same list back in a different order. Nothing is added, nothing is removed, nothing is renamed. The node description in n8n says it plainly: change items order. Because the order of items decides which one a later node treats first, and which one an email or a message ends up quoting, putting Sort in the right place is often cheaper than writing logic further down the workflow.
Three jobs come up again and again. Ranking a list before it leaves the workflow is the first: rows pulled from Google Sheets arrive in whatever order the sheet returns them, and a Simple sort on a field name puts the highest value on top, so the first item is the one worth acting on.
Picking without a pattern is the second. The Random type produces a random order in the list, which is what a rotation needs when it has to stop being predictable: shuffle a list of account owners, then let the next node assign the inbound lead to whoever landed first.
The third job is ordering on something the data does not carry as a field. The Code type takes JavaScript that determines the order of any two items, so a priority you hold in your head (paying accounts first, then trials, then free) becomes a few lines of comparison instead of a column somebody has to maintain.
When to prefer something else. Sort changes order and only order. If a field has to be computed, renamed or cleaned before it can be sorted on, Edit Fields (Set) belongs in front of it. If two lists have to become one before being ranked, Merge does the joining and Sort takes over afterwards.
Two limits are worth knowing before the first run. The Sort operation uses the default JavaScript array sort, where the elements being sorted are converted into strings and their values compared, so values line up the way text lines up rather than the way numbers or dates would. And the node runs on the items it receives without opening a workflow: a Schedule Trigger, a Webhook or a tool trigger has to come before it. For how this node sits inside the wider platform, the n8n review covers the ground.
How do you configure the Type parameter?
The Sort node has one parameter. For each one: the node as you configure it in n8n, what the parameter changes, and our field notes.
Parameters index
Type
typeWhat you see in n8n
Notes & use cases
Type is the only parameter on the node. It sets the type of sorting to perform, and the panel changes with it.
Key parameters
- Type:
simple(Simple) sorts ascending or descending on the selected fields,random(Random) creates a random order,code(Code) runs your own comparison. - Fields To Sort By: with Simple, the Add Field To Sort By button adds a Field Name, then you pick Ascending or Descending.
- Options: with Simple, Disable Dot Notation turns off reading child fields as
parent.child. - Code: with Code, holds the JavaScript that determines the order of any two items.
Need help automating Sort with n8n?
A person reads every message.
Sort in n8n, the questions that come up next
01Is the Sort node free in n8n, on Cloud and self-hosted?
02What do you need to set up before using it?
03What are the limits of the n8n Sort node?
04When should you pick Sort rather than a Code node?
05n8n or Make for this kind of ordering step?
Get our weekly integration tips.
No spam. Unsubscribe anytime.
