311_code SDXL Clip Text Encode
Weighting clip_g and clip_l separately
- clip
- CONDITIONING
SDXL doesn't run one text encoder, it runs two: CLIP-L (the same small encoder SD 1.5 used) and OpenCLIP-bigG, and it glues their outputs together for every prompt you type. The stock ComfyUI node that does this - CLIPTextEncodeSDXL - treats both encoders as equal partners with no way to turn one up or down. This node, from the small MagicClip_Strength pack, is that same node with two extra dials: clip_g_strength and clip_l_strength, so you can lean the conditioning toward whichever encoder is actually doing the work for your prompt.
Why you'd want this
CLIP-L and bigG were trained differently and don't contribute equally to every image. In practice bigG (clip_g) tends to carry more of the overall composition and style, while CLIP-L (clip_l) leans more on fine detail and phrasing. The default is 1.0/1.0 - full strength on both, same as the stock node. Turn one down and you're telling SDXL to trust that encoder's read on your prompt less; turn one up past 1.0 and you're amplifying it beyond what the model saw in training. It's a blunt instrument, not a scalpel, but it's a real knob that doesn't exist anywhere else in ComfyUI.
How it works
Under the hood this is the same size/crop conditioning trick every SDXL text-encode node uses - the model is trained with knowledge of the original image's resolution, so feeding it that signal at inference time gets you more coherent output at the resolution you're actually generating at. Where the stock node exposes six separate size fields (width, height, crop top/left, target width/height), this one collapses them to width, height, and a single size_cond_factor (default 4, range 1–16) that derives the rest. The exact formula isn't documented by the author, so treat it as an experiment knob rather than something to reason about precisely - the example image in the README shows it tuned alongside the strength values, not in isolation.
The other addition is layer_idx. ComfyUI's normal CLIP-skip convention only goes negative (stop at an earlier layer). This node lets you go positive too, up to 33, and mix positive on one prompt with negative on the other. The author is upfront that this is hit-or-miss: pushing both positive and negative prompts to the same positive layer_idx tends to produce noise, and the recommendation is to mix positive/negative values or stick to negative-only for reliable prompt adherence.
The inputs and outputs that matter
clip- plug in the CLIP output from your SDXL checkpoint loader. This node is SDXL-specific; it expects the combined CLIP-L + bigG object, not a plain SD 1.5 CLIP.text_g/text_l- your prompt text for bigG and CLIP-L respectively. You can put the same text in both (most people do) or split tags vs. natural language across them, same as the stock SDXL node.clip_g_strength/clip_l_strength- the headline feature. Default 1, range 0–1000. Stay close to 1.0 and nudge in small steps; this is a multiplier, not a percentage.layer_idx- default -2 (matches SDXL's own trained default - see the note below). Range -33 to 33.width/height/size_cond_factor- the size-conditioning trio described above. Leave at 1024/1024/4 unless you're specifically experimenting.- Output:
CONDITIONING- wire it straight into your KSampler's positive or negative input, same as any text encode node.
Worth knowing: SDXL's own encoders already condition on the penultimate layer by default (ComfyUI's sdxl_clip.py hardcodes layer_idx=-2 for both), so the -2 default here is the architecture's baseline, not a stylistic pick. Treat layer_idx as an experiment on top of that baseline, not a setting you need to chase for "correctness."
How to install it
Manager: search for ComfyUI MagicClip_Strength for SDXL and install. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/311-code/ComfyUI-MagicClip_Strength
Restart ComfyUI. No requirements.txt, no models to download - it's pure Python logic bolted onto the existing CLIP encode path, so there's nothing to fetch and nothing to go stale. In the node search box, typing "SDXL" surfaces it as 311_code SDXL Clip Text Encode.
Common issues & troubleshooting
Wrong CLIP type plugged in. Because this node expects SDXL's combined CLIP-L + bigG object, feeding it a CLIP from an SD 1.5 or SD 3-family checkpoint will error or produce garbage - it isn't a general-purpose replacement for CLIPTextEncode, only for the SDXL variant.
Both positive layer_idx values, both prompts. This is the specific failure mode the author calls out directly: setting a positive layer_idx on both the positive and negative prompt is unreliable. Either mix positive and negative values across the two, or leave both negative - that's the combination that actually holds together.
Strength cranked way past 1.0 and the image falls apart. The range goes to 1000, but that's headroom for extreme experimentation, not a usable range. Most people who get something out of this node are working in something like 0.5–1.5; treat anything past 2 as "seeing what breaks."
Small, single-purpose pack. This is a one-node pack from an individual author, so don't expect frequent updates or a large troubleshooting thread - you're mostly working from the README and your own experiments.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| width | INT | 10240–16384 | — |
| height | INT | 10240–16384 | — |
| text_g | STRING | — | |
| clip | CLIP | — | |
| text_l | STRING | — | |
| clip_g_strength | FLOAT | 1.000–1000 | — |
| clip_l_strength | FLOAT | 1.000–1000 | — |
| size_cond_factor | INT | 41–16 | — |
| layer_idx | INT | -2-33–33 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |