A workflow gets hard to change when the same five nodes are copied into four places. n8n's answer is a sub-workflow: one reusable workflow, called from a parent with the Execute Sub-workflow node, with a clear input and a clear output.
This guide shows how to set that up from n8n's official docs: the trigger, the input modes, how data comes back, and how errors are scoped between parent and child. I haven't built a new production automation for this post. The behaviour described here is the documented behaviour of the Execute Sub-workflow node and n8n's error-workflow settings.
Some links are affiliate links; they don't change your price.

What is a sub-workflow in n8n?
A sub-workflow is an ordinary n8n workflow that another workflow can run on the same instance. You call it with the Execute Sub-workflow node. The child starts with the Execute Sub-workflow Trigger, also listed as "When Executed by Another Workflow".
n8n's docs describe the data path in one loop. The Execute Sub-workflow node in the parent passes data to the trigger of the child. The last node of the child sends data back to that same Execute Sub-workflow node in the parent.
That's the whole point. You get a reusable unit with a contract: inputs in, result out. It is a better place to put a repeated HTTP call, a cleanup script, or a shared "notify the team" path than copying nodes around. If you're new to the wider canvas, my n8n workflow examples post is the gallery this pattern sits under.
A sub-workflow is not a new server and it is not a webhook from the outside world. It runs on the same n8n host as the parent.
How do I create a sub-workflow?
You can start from a blank workflow, or you can extract one from a parent.
From a parent, the official docs give you two shortcuts. In the Execute Sub-workflow node, set Source to Database and From list, then choose "Create a sub-workflow". Or select the nodes you want to extract and use Sub-workflow conversion in the context menu.
In the child workflow:
- Step 1: add the Execute Sub-workflow Trigger, if the shortcut didn't already add it.
- Step 2: open Options, then Settings, and set "This workflow can be called by" to the callers you actually want. Don't leave a shared helper callable by everything on the instance if it can send mail or write data.
- Step 3: set the trigger's Input data mode, which is the contract.
- Step 4: build the rest of the nodes that do the work.
- Step 5: save. n8n's docs are explicit: if the sub-workflow contains errors, the parent can't trigger it.

Input data mode has three official options:
| Mode | What the parent must send | When to use it |
|---|---|---|
| Define using fields below | Named fields and types, which then appear on the parent node | Almost always, for a stable contract |
| Define using JSON example | A sample object that shows the expected items and types | When the shape is clearer as JSON than as a form |
| Accept all data | Anything, with no required fields | Only if the child is ready to handle missing values itself |
I would start with "Define using fields below". The parent node then pulls in those fields automatically, which is the documented behaviour when Source is Database and From list.
If you later remove a requested field on the parent, the child receives null for it. You can also turn on "Attempt to convert types" if the parent might send a number as a string and you want n8n to try to coerce it.
"Accept all data" hides those input fields on the parent, because there is no contract to display. That's convenient for a prototype and sloppy for anything you'll reuse in six months.
How do I call the sub-workflow from the parent?
Open the parent, add the Execute Sub-workflow node, and point it at the child.
The Source field decides where the child definition comes from:
- Database, From list or Workflow ID: the usual choice. The ID is the alphanumeric string after /workflow/ in the child's URL.
- Local File: a path to a JSON workflow file on the host.
- Parameter: workflow JSON pasted into the node.
- URL: a URL that returns the workflow.
For almost every team workflow, use Database and pick the child from the list. Fill in the input fields the child requested, then save.
Two more official controls on the node change how it runs:
- Mode: "Run once with all items" sends every input item into a single execution of the child. "Run once for each item" runs the child once per item, in turn.
- Wait for Sub-Workflow Completion: when this is on, the parent waits for the child to finish before it continues. When it's off, the parent moves on without waiting.
Wait is the right default when the next parent node needs the child's output. Turn it off only when the child is a fire-and-forget side effect, such as a slow export you don't want to block on, and you have another way to watch the execution.
When both have run, the Execute Sub-workflow node has a "View sub-execution" link. The child's execution has a link back to the parent. Use those when something looks wrong, instead of guessing which run belongs to which caller.

If you want example data while you build the child, n8n documents a path on n8n Cloud and registered Community plans. Set the child's Input data mode, turn "Save successful production executions" on in the child settings, run the parent once, then load data from that previous execution and pin it on the trigger. That's official, and it beats inventing sample JSON by hand.
How are errors scoped between parent and child?
By default, if the sub-workflow fails, the parent fails at the Execute Sub-workflow node. That's the behaviour you want when the child's result is required.
If you want the parent to keep going, use Continue on Fail on the Execute Sub-workflow node. The documented shape of the error item is a JSON object with an error field containing the error message. You can then branch on that field, the same way you would after a failed HTTP Request or a Code node.
Error workflows are a separate layer. In Workflow Settings, each workflow can name an Error Workflow that starts with the Error Trigger. The official "handle errors gracefully" docs are clear: you set this per workflow. A child's error-workflow setting is not inherited from the parent, and the parent's setting is not inherited from the child.
So if you need a Slack or email alert when the helper fails, set an error workflow on the child, on the parent, or on both, depending on who should be notified. Don't assume the parent alert will fire for a failure you swallowed with Continue on Fail. My n8n error handling guide is the deeper pass on retries, error workflows and alerts.
When should I use a sub-workflow, and when should I not?
Use a sub-workflow when the same logic will be called from more than one parent, or when a single parent is getting too long to debug. Shared work I would extract first: a notification path, a "normalise this payload" path, or a repeated API call with its own retries.
Keep the work in the parent when it's used once, when the mapping is still changing every hour, or when you'd have to pass almost the entire item through just to avoid a few nodes. A sub-workflow is a boundary. If the boundary is noisier than the duplication, wait.
Don't put a huge Code node in a child just to hide complexity. The child should still be readable. And don't use a sub-workflow as a substitute for credentials: those stay in n8n's credential store, not in the payload you pass down.
If you later turn the helper into part of an AI agent in n8n, the same "Call n8n Workflow Tool" path can use the fields you already defined on the trigger. That's a documented sibling of the Execute Sub-workflow node, and it's a good reason to define inputs properly from day one.

If you self-host, I still recommend a Hostinger KVM VPS for the machine that runs n8n, so the parent and the child share one reliable host.
Frequently asked questions
Define the child's inputs, keep the last node tidy, and decide on purpose whether a failure should stop the parent. That's the whole contract.
Once the helper is stable, call it from every parent that needs it, and stop copying the same five nodes.


