Disable the Stable Diffusion NSFW Filter (2026)
Stable Diffusion's NSFW filter blacks out innocent images. Why it false-positives, how to disable it per stack, and where the legal line actually is.

TL;DR
- What it is: the NSFW block is Stable Diffusion's safety checker swapping your image for a solid black square when it thinks the output is explicit. It's a false-positive machine, not a nudity detector.
- Fast fix (diffusers): load the pipeline with
safety_checker=Noneandrequires_safety_checker=False. One change, and the black squares stop. - A1111 / ComfyUI: neither runs that filter by default. Still getting blackouts there? It's a Colab notebook wrapper or a NaN error, not the safety checker.
- Black image with no NSFW warning? Different bug. That's a VAE NaN on FP16 GPUs. Launch with
--no-half-vae. - Before you disable it: you own the weights locally, so it's your call. The license still bans illegal, non-consensual, and CSAM outputs. That line does not move.
You typed a harmless prompt, waited for the render, and got a black square. Stable Diffusion decided your picture was NSFW. Here's why that keeps happening, how to turn it off on your own machine, and where the real limits stay put.
What does "NSFW block" mean in Stable Diffusion?
It means the built-in safety checker scored your generated image as explicit and replaced it with a black image before you ever saw it. The model runs fine. The image gets made. Then a separate classifier looks at the pixels, decides they crossed a line, and blanks the result. You usually get a message like "Potential NSFW content was detected in one or more images. A black image will be returned instead."
Here's the part that matters. The checker sits after generation, bolted on rather than woven into the model, which is why disabling it is a config change and not a retrain. It also trips by accident constantly. The classifier has no idea what you asked for. It only sees the pixels that came out.
Is your black image the filter, or a NaN error?
Before you disable anything, work out which black image you actually have, because they have two completely different fixes. People conflate them constantly, then "disable the safety checker" on a bug the safety checker never caused.
Two signatures tell them apart:
- Safety-checker block: you get an NSFW warning in the console or the UI. The message literally says NSFW content was detected. This one you fix by turning off the checker.
- VAE NaN block: no NSFW message at all, sometimes a
NansException: A tensor with all NaNs was produced in VAE. This is a math failure, not a content decision. Some GPUs choke on half-precision (FP16), the numbers overflow to NaN, and the decode comes out black.
| Symptom | Real cause | Fix |
|---|---|---|
| Black image + "NSFW detected" | Safety checker false positive | Disable the checker |
| Black image, no NSFW message | FP16 NaN in the VAE | Launch with --no-half-vae |
| Black only on older cards (16xx) | No native FP16 support | Add --no-half --no-half-vae |
| Black on SDXL only | Sampler precision | Add --upcast-sampling |

No NSFW warning? Then stop reading the disable-the-filter guides. Your problem is precision, and --no-half-vae clears the large majority of VAE NaN cases at roughly a 5 to 10 percent speed cost. Turning off a safety checker that never triggered hides nothing and burns an afternoon.
Why does the filter flag innocent prompts?
Because it doesn't detect nudity. It measures similarity to hidden concepts, and plenty of harmless images land near them by accident. Under the hood the checker is CLIP. It runs your output through CLIP's ViT-L/14 image encoder to get an embedding, then compares that embedding to 17 fixed vectors, each standing for a "sensitive concept." If the cosine similarity to any one of them clears a threshold, the image is blacked out.
Those 17 concept vectors are hidden on purpose, so nobody can reverse-engineer them. The side effect is that you can't see what you're tripping. A landscape, a fractal, a portrait, a plate of food, anything whose embedding drifts near one of those vectors gets flagged. Developers on the CompVis issue tracker reported the prompt "star" getting blocked. Another got flagged for "riding horse." One wrote, half joking, "maybe my PC is not safe for work."
So this is not a precise moral judgment. It's a blunt distance check with a fixed cutoff, tuned to over-block. For a lot of real work, the false positives outnumber the true ones by a wide margin.
How do you disable the NSFW filter in Stable Diffusion?
Find the section for your stack, because "Stable Diffusion" means three or four very different pieces of software and only one runs this filter by default.
Diffusers (Python)
This is the one that actually ships the checker on. Pass safety_checker=None when you load the pipeline, and set requires_safety_checker=False to silence the follow-up warning:
from diffusers import StableDiffusionPipeline
import torch
pipe = StableDiffusionPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5",
safety_checker=None,
requires_safety_checker=False,
torch_dtype=torch.float16,
)You can also flip it after the pipeline exists with pipe.safety_checker = None. Prefer to keep the hook but never block? Replace it with a pass-through that reports nothing was flagged:
pipe.safety_checker = lambda images, **kwargs: (images, [False] * len(images))Same result, no repeated warning spam in your logs. The actual safety_checker source is short if you want to read exactly what it does.
AUTOMATIC1111 / Forge
Good news: neither runs the diffusers safety checker by default. If you're getting NSFW blackouts in A1111 or Forge specifically, the usual culprit is a Colab notebook that patched a filter back in, or an extension. Search your notebook cell for safety_checker or a check_safety function and comment it out. On a normal local install there's nothing to disable, because it was never on.
ComfyUI
Same story: no safety filter by default. A stock ComfyUI graph won't black out your images for content. If yours does, a custom node added it. Remove that node, or check the wrapper you launched through.
Editing model_index.json
If a checkpoint keeps loading a checker no matter what your code says, open its model_index.json, set "requires_safety_checker": false, and remove the safety_checker entry. That stops the module from loading at all. Useful for a downloaded model that bundles its own filter config.
Don't want to nuke it? Tune it instead.
Disabling the checker outright is the common move. It isn't the only one, and on a shared or public deployment it isn't the smart one. Three middle-ground options:
- Detect and handle, don't blank. The pipeline can return a per-image NSFW flag instead of silently blacking things out. Keep the flag, drop the block, and route or log flagged images yourself.
- Swap in Safe Stable Diffusion. Instead of a black square, it steers generation toward the nearest non-explicit image. You keep a usable output and a guardrail.
- Raise the threshold, don't remove it. If you can edit the checker, loosening the cutoff cuts false positives while still catching the obvious stuff. More work, far fewer surprises than all-or-nothing.
For a solo project on your own GPU, safety_checker=None is fine. For anything users can reach, keep a guardrail. A public endpoint with no filter is a liability you'll regret.
Is disabling the safety checker even legal?
Turning it off is allowed. What you generate with it off is where the real limits live, and those don't vanish when the filter does. Stable Diffusion ships under the CreativeML Open RAIL-M license. It grants broad rights, claims nothing on your outputs, and puts accountability on you. It also carries use-based restrictions with teeth.
The license explicitly bars using the model to produce or share illegal or harmful content. No CSAM. No non-consensual intimate imagery. No deepfakes of real people made to deceive or harm. Those aren't filter settings. They're laws in most of the world, and "the safety checker was off" is not a defense anywhere.
So here's the honest framing. On hardware you own, running weights you downloaded, you get to configure your own tooling, and switching off an over-eager false-positive filter for real work is reasonable. Generating illegal content is not, filter or no filter. Keep those two ideas apart and you're on solid ground.
What if you're on a hosted API instead of local?
Then the filter isn't yours to disable, and that's the whole difference. When you call a hosted image endpoint, the provider runs the model and enforces its own content policy server-side. There's no safety_checker=None you can pass. You accept their rules, or you run locally.
That trade is worth naming plainly. Local Stable Diffusion gives you full control, safety checker included, at the cost of a GPU, driver setup, and your own moderation. A hosted API like Velokey's image endpoints skips the setup and hands you one key across models, but you're inside the provider's content policy, not outside it. Hoping a gateway lets you bypass content rules? It won't, and any that claim to are a compliance problem waiting to happen. Pick hosted for convenience and scale, local for control. If you're weighing image APIs in general, our ChatGPT image limits breakdown and the Qwen-Image 2.0 notes cover what hosted generation actually costs and caps, and Seedream 5.0 Pro covers a higher-end option. Hitting a totally different AI error instead? Our ChatGPT error in message stream fix is the sibling to this guide.
Frequently Asked Questions
How do I remove the NSFW filter in Stable Diffusion?
Depends on your stack. In the diffusers library, load the pipeline with safety_checker=None and requires_safety_checker=False. In AUTOMATIC1111, Forge, and ComfyUI there's usually nothing to remove, since they don't run that checker by default. If you still get blackouts, a notebook wrapper or a custom node added the filter back.
Why does Stable Diffusion return a black image for a normal prompt?
Two possible reasons. Either the safety checker false-flagged your image as NSFW, and you'll see an NSFW warning, or the VAE produced a NaN on a half-precision GPU, with no warning and sometimes a NansException. The first is fixed by disabling the checker, the second by launching with --no-half-vae.
Does ComfyUI have an NSFW filter?
No, not by default. A stock ComfyUI install won't block images for content. If yours is producing black squares with an NSFW message, a custom node or an external wrapper you're running added a safety checker. Remove that node and the blocking stops.
Why did my innocent prompt get flagged as NSFW?
Because the checker measures visual similarity to hidden concept vectors, not actual nudity. Harmless images sometimes land close to those vectors by chance. Reported false positives include prompts as tame as "star" and "riding horse." The filter over-blocks by design, so benign flags are common.
Is it against the license to disable the safety checker?
No. The CreativeML Open RAIL-M license lets you configure your local tooling, including turning off the checker. What it does prohibit is the output: illegal, non-consensual, or harmful content stays banned whether the filter is on or off. You're accountable for what you generate, not for the checker's state.
How do I stop the safety_checker warnings in my logs?
Set requires_safety_checker=False when you load the pipeline, alongside safety_checker=None. Prefer to keep the attribute set? Replace it with a dummy that returns the images and an all-False flag list. Both silence the repeated warning diffusers prints on every call.


