Donut Clip Encode
An SDXL text encoder that knows the resolution it's drawing at
- clip
- CONDITIONING
The core CLIP Text Encode node gets you 95% of the way, and this node is for the other 5% where you care about how SDXL conditions on resolution. DonutClipEncode is a dual-text-encoder SDXL encoder that bakes width and height into the conditioning itself, so the model isn't guessing at what size canvas you're drawing on.
SDXL uses two text encoders - the big OpenCLIP clip_g and the smaller clip_l - and core ComfyUI folds them into one encode. This node gives you both text boxes (text_g, text_l) plus a pile of levers for how they combine. The one input most people actually change is width and height (default 1024×1024): set them to match your latent size and the encoder feeds a resolution-aware condition that tells SDXL "this prompt is for a landscape canvas," which matters more than you'd think for composition and for avoiding that flat, resolution-confused look.
The knobs that matter
The 15 inputs look intimidating; most are only relevant if you're chasing a specific effect. The ones worth knowing:
mode- Mix Mode blends the two encoders with sliders; Strength Mode scales each encoder's output independently. The defaults (0.5 mixes, 1.0 strengths) are sane for most work.preset- shortcuts like "Split vs Pooled" and "Continuous" that set up the blend patterns for you. If you don't know what "Split vs Pooled" means, you don't need it yet.layer_idx(default −2) - which CLIP layer's pooled output to draw from for the pooled-text part of the SDXL condition. This is the clip-skip-flavored knob: moving it deeper (more negative) changes how much semantic abstraction the condition carries.size_cond_factor(default 4) - how aggressively the resolution hint is scaled into the conditioning. Leave it unless you're deliberately testing.
Output is a single CONDITIONING that wires straight into your sampler like any other text encode output.
Why you'd bother
Honestly, most workflows never need this. The core encoder is faster to use and produces identical results at the default settings on a fixed canvas. This node earns its keep when you're doing one of three things: feeding a sampler that changes resolution per run (batch of aspect ratios), tuning how much the pooled CLIP layer drives the image, or experimenting with how strongly the model feels the canvas size. It's a "when you know you need it" node, not a "try it because it's there" node.
The pack frames it under category "essentials", which is generous - it's an advanced essential.
Installing and gotchas
Same pack as everything else here: ComfyUI Manager → search DonutNodes, or clone the repo into custom_nodes/ and pip install -r requirements.txt with the same Python that runs ComfyUI. No extra model downloads; it reuses the CLIP that comes out of your checkpoint loader.
Two things trip people up. First, both text_g and text_l are required fields - leave one blank and SDXL still encodes, but you're giving up half the model's text understanding for no reason. Put your prompt in both, or leave text_l empty only if you know the checkpoint handles it. Second, the width/height here don't resize anything - they only tag the conditioning. If your latent is 768×1024 and this node says 1024×1024, you've created a mismatch that shows up as subtly wrong composition, not an error. Keep them in sync with your Empty Latent and it's a genuinely useful little tool.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| width | INT | 10240–16384 | — |
| height | INT | 10240–16384 | — |
| text_g | STRING | — | |
| text_l | STRING | — | |
| mode | COMBO | 2 options: Mix Mode, Strength Mode | |
| clip_gl_mix | FLOAT | 0.500–1 | — |
| vs_mix | FLOAT | 0.500–1 | — |
| clip_g_strength | FLOAT | 1.000–1000 | — |
| clip_l_strength | FLOAT | 1.000–1000 | — |
| strength_default | FLOAT | 1.000–10 | — |
| strength_split | FLOAT | 1.000–10 | — |
| strength_continuous | FLOAT | 1.000–10 | — |
| preset | COMBO | 8 options: Default, Split Only, Continuous, Split vs Pooled, Split vs Continuous, Default vs Split, +2 | |
| size_cond_factor | INT | 41–16 | — |
| layer_idx | INT | -2-33–33 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |