Resources · n8n integration

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

Why automate

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.

Parameters

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.

01

Type

type

What 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.
Use cases
rank invoices by amount before a summary goes out, or shuffle a duty list.
Need help

Need help automating Sort with n8n?

A person reads every message.

FAQ

Sort in n8n, the questions that come up next

01Is the Sort node free in n8n, on Cloud and self-hosted?
Yes. Sort is a core node shipped with n8n, so there is no installation and no extra cost, and it behaves the same on n8n Cloud, the hosted offer run by n8n, as on an instance you host yourself with Docker or npm under the Community Edition and its Sustainable Use license. A workflow built on one runs on the other without changes. What you pay for is the plan you already have, not the node. Nothing about Sort is gated behind a tier, and the node carries no usage counter of its own.
02What do you need to set up before using it?
Nothing on the account side. Sort has no credential and no Authentication selector, so there is no key to paste, no scope to grant and no connection to test before the first run. What it does need is data and a starting point: the node runs on the items it receives and does not open a workflow by itself, so a Schedule Trigger, a Webhook or the trigger of a tool has to sit in front of it. Drop it into an existing branch, pick a Type, and it works.
03What are the limits of the n8n Sort node?
The main one is how comparison works. The Sort operation uses the default JavaScript array sort, where elements are converted into strings and their values compared, so anything that is not plain text lines up as text. Beyond that, the node reorders items and does nothing else: it will not filter, deduplicate or reshape them. Version 1 is the version described here; an older workflow can still show an earlier one with fewer options, and a node never changes version on its own. Dot notation for child fields can be switched off, but only under the Simple type.
04When should you pick Sort rather than a Code node?
Pick Sort whenever the ordering rule can be expressed as fields and a direction. With the Simple type you add a Field Name, choose Ascending or Descending, and you are done, which is faster to read six months later than a script. Reach for the Code type inside Sort when a simple sort will not meet your needs, since that is exactly what the option is there for: JavaScript that determines the order of any two items. Only step outside the node when you need to change the items themselves rather than their order.
05n8n or Make for this kind of ordering step?
It depends on where you want the work to run. Make, formerly Integromat, is a hosted automation platform with no self-hosting option and billing per operation, so a workflow that reorders large batches often has a cost attached to its volume. n8n can be self-hosted with Docker or npm, which keeps the data on infrastructure you control, or used on n8n Cloud when hosting is not what you want to spend time on. Both build visually. The honest split is hosting, data control and cost model rather than one being better at sorting.
Hack'celeration Lab

Get our weekly integration tips.

No spam. Unsubscribe anytime.