Nodes/ComfyUI_RErouter_CustomNodes/CLIPTextEncodeSDXL (RE)
ComfyUI Node

CLIPTextEncodeSDXL (RE)

SDXL's dual-prompt encoder, same fields as stock

By an90ray·Created 3 years ago·Updated 2 years ago· 0
CLIPTextEncodeSDXL (RE)
  • clip
  • CONDITIONING
width4096
height4096
crop_w0
crop_h0
target_width4096
target_height4096
text_g
text_l

SDXL doesn't use one text encoder, it uses two stitched together - and this node is where you feed both. It's this pack's copy of ComfyUI's native CLIPTextEncodeSDXL node, field for field: two text boxes, six size/crop numbers, one CLIP input, one CONDITIONING output. If you've only ever used the plain CLIPTextEncode, the extra fields here look intimidating the first time you see them. They're not, once you know what they're doing.

SDXL's "dual" part is text_g and text_l. text_g goes to CLIP-G (OpenCLIP ViT-bigG), which leans more toward natural-language description; text_l goes to CLIP-L, which behaves more like the tag-heavy style Danbooru-trained models expect. In practice most people just type the same prompt into both and move on - that collapses back to ordinary CLIPTextEncode behavior - but splitting them lets you push scene description through one and style or quality tags through the other if you want finer control.

The six number fields - width, height, crop_w, crop_h, target_width, target_height - aren't your output resolution, even though it's tempting to treat them that way. They're SDXL's size-conditioning trick, baked in at training time. width/height tell the model roughly what resolution the training image was; crop_w/crop_h tell it how much got cropped off the top-left before training (leave these at 0 unless you're deliberately replicating a cropped composition); target_width/target_height are the resolution you actually want out. For a normal run, set width/height and target_width/target_height to match your real generation size and leave the crop values at zero.

The inputs and outputs that matter

  • text_g / text_l - your prompt, split across the two encoders. Putting the same string in both is the safe default if you're not chasing finer control.
  • clip - from your SDXL checkpoint's CLIP output. This node expects an SDXL-shaped CLIP; feeding it an SD1.5 clip will error.
  • width / height / crop_w / crop_h / target_width / target_height - the size-conditioning fields above. They default to 4096 here, well above SDXL's native 1024 training resolution - don't leave them there. Set width/height/target_width/target_height to whatever you're actually generating at (1024×1024 for a standard SDXL run) and crop_w/crop_h to 0.
  • CONDITIONING - wire to your KSampler's positive or negative input.

How to install it

Same repo as every node in this pack. ComfyUI Manager: search ComfyUI_RErouter_CustomNodes, install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/an90ray/ComfyUI_RErouter_CustomNodes.git

Restart ComfyUI afterward. No model downloads, no extra dependencies - this is pure node-graph plumbing.

Common issues & troubleshooting

"What do text_g and text_l actually do?" is the single most common confusion around this node's stock counterpart, and it's a fair question - neither the pack's README nor ComfyUI's own docs explain it. The short version: G is natural language, L is tag-style, and if you're not sure, put the same prompt in both and move on.

Output looks flat or oddly composed. Check crop_w/crop_h didn't get left at some nonzero value from a copied workflow - a nonzero crop tells the model to condition on a cropped composition, which shows up as unexpected framing or a cut-off subject.

Wrong CLIP type wired in. As with the plain encoder, an SD1.5 CLIP won't work here - this node is SDXL-specific end to end, and mixing model families is the most common reason a beginner's conditioning comes out wrong.

Category(RE)router

Inputs (9)

NameTypeDefaultDescription
widthINT40960–16384
heightINT40960–16384
crop_wINT00–16384
crop_hINT00–16384
target_widthINT40960–16384
target_heightINT40960–16384
text_gSTRING
clipCLIP
text_lSTRING

Outputs (1)

NameTypeDescription
CONDITIONINGCONDITIONING