Normalize Workflow IDs
Make a messy ComfyUI workflow's IDs clean and sequential
- normalized_workflow
Open a shared workflow's JSON and the node IDs look like a lottery draw: 4, 77, 209, 1305. Works fine, impossible to reason about. Normalize Workflow IDs takes any workflow and renumbers every node in order, starting at 1 (or wherever you want) and counting up by whatever step you like. The result is a file where node IDs are 1, 2, 3 - readable, diffable, and safe to merge with anything else.
Why you'd reach for it
Node IDs matter more than beginners think. In the API workflow format the node ID is literally the dict key - {"10": {"inputs": ...}} - so it's what you use to address a node when you're driving ComfyUI's /prompt endpoint or editing JSON by hand. Sequential IDs make that far easier to read. And if you've ever tried to merge two workflows, you know the pain of two graphs that both claim node 12; normalize one of them first and the ID spaces can't collide. It's also just hygiene before you share a workflow, in the same spirit as formatting code before a PR.
How it works
You give it the workflow and it collects the current node IDs, sorts them numerically (2, 10, 100 - not alphabetically, so no 10-before-2 weirdness), then maps them in order onto start_id, start_id + step, and so on. A workflow with nodes 4, 77, and 209 becomes 1, 2, 3 by default. It handles both the API format and the UI format ({"nodes": [...], "links": [...]}), updating link endpoints and group membership the same way the rest of this pack does.
You'll find the same tool on the live canvas, by the way: right-click empty space → "Normalize All Node IDs" renumbers the graph in front of you. The node version exists for JSON that isn't on canvas - a downloaded file, one you're about to send through the API, or a workflow you're editing as text. The canvas version always starts at 1 with step 1; the node gives you knobs.
The inputs that matter
workflow_json- paste it, or use the "Load Workflow" button on the node.start_id- the first ID to use, an integer from 1 to 99999, default 1. Set it to 1000 and your normalized workflow will never collide with a workflow that uses low IDs.step- the spacing between consecutive IDs, 1 to 100, default 1. Step 10 leaves gaps you can hand-fill later.
The single output, normalized_workflow, is a STRING of pretty-printed JSON. Save it with the "Save Workflow" button, copy it, or paste it back into ComfyUI.
The honest caveats
This is the pack's aggressive renumber at its most dangerous, because you're rewriting a lot of IDs at once and the engine replaces any string that matches an old ID anywhere in the file - including text inside widgets. A prompt that contains "77" can come out altered. It also doesn't check for collisions, so run it on a copy, verify the output still loads, and only then overwrite your working file. Invalid JSON returns a {"error": ...} object instead of crashing, which at least fails loudly. It's a young, single-commit MIT pack, so temper expectations on polish.
Installing it
No dependencies, no models - the pack is built on Python's stdlib plus one frontend script. ComfyUI Manager: search "Node ID Modifier". Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/jjlwmy/comfyui-node-id-modifier
Restart ComfyUI; it sits under utils → ID Tools. For the one thing it does - turning a scatter of IDs into a clean sequence - it's hard to beat, and it pairs well with Batch Modify Node IDs for the merge jobs that follow.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| workflow_json | STRING | {} | — |
| start_id | INT | 11–99999 | — |
| step | INT | 11–100 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| normalized_workflow | STRING | — |