Nodes/ComfyUI/CLIP Text Encode (SDXL)
ComfyUI Node Runs on cloud

CLIP Text Encode (SDXL)

The two-prompt encoder SDXL actually wants

By Comfy-Org·Created 4 years ago·Updated 16 days ago· 121,575
CLIP Text Encode (SDXL)
  • clip
  • CONDITIONING
width1024
height1024
crop_w0
crop_h0
target_width1024
target_height1024
text_g
text_l

SDXL doesn't use one text encoder - it uses two, CLIP-L and the bigger OpenCLIP-G, and their outputs get combined into the conditioning that steers generation. The plain "CLIP Text Encode (Prompt)" node feeds the same text to both. CLIPTextEncodeSDXL is the advanced version that lets you send a different prompt to each encoder, plus set the size-conditioning values SDXL was trained with. It's the node to reach for when you want fine control over how SDXL reads your prompt.

Quick, honest heads-up: this is a built-in ComfyUI node (it lives in core's comfy_extras, not in a custom pack), so there's nothing to install - it ships with a stock ComfyUI. If you found this looking for a download, good news, you already have it.

How it works

SDXL's two encoders don't do the same job. As the concept notes put it, SDXL "uses two text encoders: CLIP-L and OpenCLIP-G. Both process your prompt, and their outputs are combined." Splitting them lets you play to each one's strengths. On top of that, SDXL was trained with conditioning on image size and crop - the model was told what resolution and framing each training image was, so at inference you pass those same numbers to nudge composition. That's what the width/height/crop/target inputs are for; they're not a resize, they're a signal.

The inputs and outputs that matter

  • clip (CLIP) - your loaded SDXL CLIP.
  • text_g and text_l (multiline strings) - the two prompts. A common approach is to put natural-language, descriptive phrasing in one and keep tag-style keywords in the other; many people simply paste the same prompt into both and still benefit from the size conditioning. Both matter - don't leave one empty by accident.
  • width / height (default 1024) - the size conditioning. Set these to your generation resolution.
  • target_width / target_height (default 1024) - the intended output size the model should aim its composition at.
  • crop_w / crop_h (default 0) - the crop offset conditioning; 0/0 means "no crop," which is what you want unless you're deliberately simulating a cropped framing.

Output: CONDITIONING - wire it into your KSampler's positive (and a second copy for negative).

How to install it

Nothing to install - it's a core ComfyUI node, available out of the box under the conditioning menu. If you don't see it, your ComfyUI is simply out of date; update it.

Common issues & troubleshooting

One of the prompt boxes is empty and results are off. Both text_g and text_l feed the model. If you only fill one, you're under-driving one encoder. When in doubt, put the same prompt in both.

The size fields aren't resizing my image. They're not supposed to. width/height/target_* are conditioning - they tell SDXL what size context to imagine, not what canvas to render. Your actual pixel dimensions come from the Empty Latent Image node. Set both to match, though, so the signals agree.

Do I even need this over the basic encoder? For most casual prompts, the standard encoder is fine. Reach for this one when you specifically want per-encoder prompts or want to exploit SDXL's size/crop conditioning - otherwise it's extra sliders you'll leave at defaults.

Categorymodel/conditioning/stable diffusion

Inputs (9)

NameTypeDefaultDescription
clipCLIP
widthINT10240–16384
heightINT10240–16384
crop_wINT00–16384
crop_hINT00–16384
target_widthINT10240–16384
target_heightINT10240–16384
text_gSTRING
text_lSTRING

Outputs (1)

NameTypeDescription
CONDITIONINGCONDITIONING