Nodes/comfyui-workflow-prettier/Workflow Prettifier
ComfyUI Node

Workflow Prettifier

Your ComfyUI canvas is a mess — this node untangles it in one click

By deepme987·Created 6 months ago·Updated 6 months ago· 7
Workflow Prettifier
      layout
      direction
      group_handling
      horizontal_spacing100
      vertical_spacing100
      group_padding100

      If you've built a ComfyUI workflow past the tutorial stage, you know the feeling: you drag-copy a block of nodes, reroute a few wires, add an upscale pass, and suddenly the canvas looks like a plate of spaghetti drawn by a caffeinated spider. ComfyUI will happily run a messy graph - nodes don't care where they sit - but you have to care, because the next time you open that workflow you'll spend ten minutes tracing wires. Workflow Prettifier exists so you don't have to. It's the "auto-format" button your node graph never had, and the name is a nod to the code formatter Prettier for the same reason: one click, tidy layout, done.

      The node is a pure frontend utility, which is why it's nearly risk-free to install. The Python class is a no-op stub - it returns nothing and does nothing at execution time. All the real work lives in the bundled web/workflow_prettier.js (the pack ships zero pip dependencies and zero models, a rarity in the custom-node ecosystem where dependency conflicts are the top complaint). When you hit Prettify!, the JavaScript reads your graph's nodes and links, builds a DAG, sorts it into execution order, and lays the nodes out according to the algorithm you picked, then repaints the canvas.

      The inputs that actually matter

      The node is a controller, not a data node: it has no outputs, and you don't wire anything into it. It has six settings that matter:

      • Layout - the big one. Layered (Vertical Stacks) is the Sugiyama-style default: nodes grouped into DAG columns with crossing minimization, ideal for standard branching pipelines. Linear puts everything in one execution-order row, great for simple chains. Compact (Tight Rectangle) packs nodes into the smallest area - note it ignores connections, so it's pure space saving, not readability. Sort by Type groups identical node types into columns, handy for spotting duplicate blocks.
      • Group handling - Auto (Respect Groups) arranges nodes inside each group, then positions groups as blocks. Ignore Groups flattens everything.
      • Direction - Left to Right, Top to Bottom, or Right to Left. (No bottom-to-top, in case that matters to you.)
      • Spacing - horizontal, vertical, and group-padding integers, with sane defaults of 100.

      You also get a Prettify! button, an Undo button (the undo stack is 10 deep and restores both node positions and group bounds), an Equalize Spacing button, and a Details toggle that explains each setting on the node itself.

      Two ways to use it

      Fastest: right-click an empty canvas → Prettify Workflow → pick a layout. That uses sensible defaults (Layered, left-to-right, auto groups), no config needed. When you want control, drop the Workflow Prettifier node on the canvas (search "Workflow Prettifier" or find it under utils), set your options, and click Prettify.

      There's also a manual touch: select 2+ nodes, right-click any selected node → Align / Distribute, and you get align left/right/top/bottom, center, and distribute evenly. Good for nudging a handful of nodes without nuking your whole layout.

      Installing it

      cd ComfyUI/custom_nodes
      git clone https://github.com/deepme987/comfyui-workflow-prettier.git
      

      Then restart ComfyUI. Or search "Workflow Prettier" in ComfyUI Manager and install from there - same result, no manual clone. No pip install step, no model files to chase down.

      Where people get burned

      The common confusions are quick to hit: the node has no outputs, so stop looking for a wire to attach. The quick right-click path uses defaults only - you can't tune spacing from that menu, so use the node for fine control. Compact layout will happily stack nodes into a perfect square that has nothing to do with how data flows, so don't expect it to preserve readability. And if you prettify, then keep editing, the undo stack only remembers what was there when you clicked - it won't save you from a bad edit you made afterward. One more: because it's a frontend extension, a freshly installed version sometimes hides behind the browser cache - hard-refresh (Ctrl+Shift+R) if the right-click menu doesn't show up after you restart.

      It won't make you a better workflow author. But it'll make your workflows look like you care, which is the next best thing.

      Categoryutils

      Inputs (6)

      NameTypeDefaultDescription
      layoutCOMBO4 options: Layered (Vertical Stacks), Linear, Compact (Tight Rectangle), Sort by Type
      directionCOMBO3 options: Left to Right, Top to Bottom, Right to Left
      group_handlingCOMBO3 options: Auto (Respect Groups), Respect Groups, Ignore Groups
      horizontal_spacingINT10030–400
      vertical_spacingINT10020–200
      group_paddingINT10020–150

      Outputs (0)

      No outputs