Batch Modify Node IDs
Renumber every node in a ComfyUI workflow in one paste
- modified_workflow
Every node in a ComfyUI graph carries an invisible ID number. You never see it while you're dragging wires, but it's in the JSON, and it's what the API actually addresses nodes by - {"10": {"inputs": ...}} is a workflow where node 10 is a dict key. Batch Modify Node IDs lets you renumber a whole pile of them at once: paste in a workflow, hand it a mapping of old→new IDs, and it returns a rewritten workflow.
Why you'd actually use this
Two reasons, honestly. The big one is merging workflows. ComfyUI hands out IDs as you add nodes, so two graphs will always collide eventually - this one has a node 12, that one has a node 12, and now you're hand-editing JSON to untangle them. A batch remap (shift one whole workflow's IDs up by +100, say) makes two graphs fit together before you combine them.
The second is tidiness before sharing. Grab a workflow from the community and it's full of IDs like 47, 128, 1302 - fine for running, ugly for anyone trying to read the file or diff two versions. Renumbering to sequential 1, 2, 3 makes a shared workflow legible. Same reason people format their code before a PR.
How it works
You give it two JSON objects: the workflow, and a mapping where each key is an old node ID and each value is the new one:
{
"10": "100",
"11": "101",
"12": "102"
}
It detects which format the workflow is in - the API format (a flat dict of node IDs to inputs) or the UI format, the {"nodes": [...], "links": [...]} shape ComfyUI saves - and rewrites both. Node IDs change, and crucially the connections do too: in a UI-format link array, position 1 is the origin node and position 3 is the target node, so those get updated along with node definitions and group membership. Give it invalid JSON and it won't crash - you get a {"error": ...} object in the output instead.
The inputs that matter
Only two, and both are paste-in fields:
workflow_json- the workflow, multiline. Or hit the "Load Workflow" button the pack adds and pick a .json file.id_mapping- the JSON object above.
That's the whole list. The output is modified_workflow, a STRING of the rewritten pretty-printed JSON. Copy it, use the "Save Workflow" button to write it to disk, or paste it back into ComfyUI.
The gotcha that will bite you
The renumbering is aggressive. It doesn't just touch node IDs - it rewrites any string anywhere in the file that matches a mapped ID, including values sitting inside widgets. Map "10": "100" and if some node's text input happens to contain the string "10", it gets rewritten too. Mostly harmless when the IDs are big numbers nobody types, but it's exactly the kind of thing that corrupts a workflow invisibly. Back up before you run it. There's also no collision check: map two nodes onto the same new ID and one silently disappears (dict keys overwrite). The canvas-side shortcut at least warns you about that; the JSON node won't.
Installing it
The lightest install in the ecosystem: no dependencies, no model files - just Python's built-in json module plus one frontend script. Via ComfyUI Manager, search "Node ID Modifier". Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/jjlwmy/comfyui-node-id-modifier
Restart ComfyUI, then look under utils → ID Tools in the Add Node menu. Note this is a young, single-commit, MIT project - expect rough edges and a small issue tracker. For a one-off single ID, the plain Modify Node ID node is less setup; this one earns its keep on real renumber jobs.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| workflow_json | STRING | {} | — |
| id_mapping | STRING | {} | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| modified_workflow | STRING | — |