Troubleshooting

How to Fix Bad Hands and Extra Fingers in Stable Diffusion

PhoneDiffusion
How to Fix Bad Hands and Extra Fingers in Stable Diffusion

Fixes

To fix bad hands and extra fingers in Stable Diffusion, keep the image and inpaint only the hand: mask it with a small margin, describe the hand you want, and generate several attempts. To prevent them, give hands a simple pose and enough pixels, put ‘bad hands, extra fingers’ in the negative prompt, and try more seeds; that lowers the odds but does not guarantee five fingers.

How to fix bad hands and extra fingers: the short answer

The fastest way to fix bad hands in Stable Diffusion is to keep the image and redraw only the hand. Mask the hand with a little room around it, write a prompt that describes the hand and what it is doing, and inpaint a few times; keep the attempt with the right number of fingers. Even the authors of the HandRefiner research tool say that changing the seed can be very helpful when a repair fails.

Prevention helps, but nothing guarantees five fingers. Give hands a simple pose and enough pixels, list hand errors in the negative prompt, and generate a few seeds before you start repairing. For stubborn cases, desktop tools can find hands automatically (ADetailer) or guide the repair with a depth or pose ControlNet (HandRefiner, OpenPose).

Why Stable Diffusion draws extra fingers

Hands are hard for diffusion models. The HandRefiner paper describes the typical failures, incorrect finger counts and irregular shapes, and explains them by how hard it is to learn the physical structure and pose of hands from training images in which hands bend, deform, and hide each other. Its examples show malformed hands from both Stable Diffusion and SDXL.

Model makers say the same. The SD 1.5 and SDXL base model cards list ‘Faces and people in general may not be generated properly’ among their limitations (distorted faces have their own fixes), and the Animagine XL 4.0 card says the model may struggle with hand poses and finger counting. A different checkpoint can do better, but plan a repair step instead of expecting perfect hands from one generation.

Prevent bad hands before you generate

Ask for a simple, readable pose: one person, hands open or resting, fingers not interlaced, and no small objects gripped between them. Overlapping and hidden fingers are exactly the conditions the HandRefiner authors call hard. If the hands do not matter to the picture, framing them out of the shot is a legitimate fix.

Give the hands enough pixels. A small hand in a wide shot has little room for five separate fingers, so frame closer, or use AUTOMATIC1111's Hires. fix, which renders at a lower resolution, upscales, and adds detail in a second pass at the higher resolution.

Add hand errors to the negative prompt. AUTOMATIC1111 uses the negative prompt in place of the empty unconditional prompt during sampling, which steers the image away from what it lists. The recommended negative prompt on the Animagine XL 4.0 model card includes ‘bad hands’, ‘missing finger’, ‘extra digits’, and ‘fewer digits’, yet the same card still lists finger counting as a limitation: a negative prompt lowers the odds rather than fixing hands.

Then generate a small batch with different seeds and keep the image whose hands are closest to right before you repair anything; Stable Diffusion seeds explained covers locking in the composition you choose.

How to fix hands with inpainting in AUTOMATIC1111

Send the image to img2img, open the Inpaint tab, and paint over the hand, including a little of the wrist and the space around the fingers. Set Inpaint area to Only masked: the wiki explains that only the masked region is then resized to the target resolution and pasted back into the picture, so the hand gets far more pixels than it had in the full image. Only masked padding, pixels (32 by default) sets how much of the surroundings the model sees.

Masked content decides what the redraw starts from. The default, original, starts from the existing hand and keeps its position and lighting; fill, latent noise, and latent nothing replace it before the redraw and suit a hand that needs a different pose. Denoising strength (0.75 by default in img2img) sets how much changes: lower values keep more of the original shape, higher values redraw more. Mask blur (4 by default) softens the seam.

Prompt for the hand rather than the whole scene, for example ‘a relaxed open hand resting on the table’ plus the scene's lighting words. Generate a batch, keep the best, and repeat with a smaller mask on any finger that is still wrong. A dedicated inpainting checkpoint usually blends better: AUTOMATIC1111 supports one, and Diffusers notes that inpaint-specific checkpoints make more natural transitions but are more likely to change the unmasked area.

PhoneDiffusion generates on-device on iPhone or iPad, with optional cloud models. Download on the App Store →

Inpainting hands in ComfyUI and Diffusers

In ComfyUI, right-click the Load Image node, choose Open in MaskEditor, paint the hand, and save. The official tutorial then feeds the image and mask into VAE Encode (for Inpainting), whose grow_mask_by setting (6 by default) widens the mask for a smoother transition, and recommends a dedicated inpainting checkpoint.

That node fills the masked pixels with neutral gray before encoding, so it suits a full redraw at the KSampler's default denoise of 1.0. To keep the broken hand's position as a starting point instead, encode with the normal VAE Encode, add Set Latent Noise Mask with the same mask, and lower denoise; the KSampler's tooltip says lower values keep more of the original structure.

In Diffusers, an inpainting pipeline takes the image, a mask (white pixels are repainted, black pixels are kept), the prompt, and strength. Setting padding_mask_crop crops the masked area with padding, upscales it for inpainting, and overlays it on the original, the same idea as Only masked. If the rest of the image must stay pixel-identical, apply_overlay forces the unmasked area back to the original.

Automatic hand fixing: ADetailer and HandRefiner

ADetailer is an AUTOMATIC1111 extension that does automatic masking and inpainting. Its hand_yolov8n.pt model detects 2D and realistic hands, and the extension then inpaints each detected area with options that mirror the Inpaint tab; Mask erosion (-) / dilation (+) shrinks or grows the detected mask. The maintainer notes that it was developed and tested with SD 1.5 on the latest AUTOMATIC1111.

HandRefiner goes further. It reconstructs a hand mesh with the correct number of fingers, fitted to the pose in the image, and uses it as depth guidance for a ControlNet inpainting pass that leaves the rest of the picture untouched. The authors recommend a control strength of about 0.4 to 0.8 rather than 1, which can lose texture. It is built on SD 1.5 (the paper resizes SDXL images to 512×512), and its README says the preprocessor has been ported to ComfyUI's ControlNet auxiliary nodes and to the AUTOMATIC1111 ControlNet extension. If the detected mask misses a long finger, raise the padding or draw the mask by hand.

Guide the hand pose with ControlNet

When you need a specific gesture, give the model the structure instead of hoping the prompt produces it. A ControlNet steers a diffusion model with a control image, such as a pose skeleton or a depth map, while you keep the text prompt. In Diffusers, controlnet_conditioning_scale sets how strongly it steers, and ControlNet also works with inpainting, so you can constrain just the hand.

For SD 1.5, the ControlNet 1.1 OpenPose model accepts body, hand, and face keypoints. Its maintainers recommend the Openpose Full preprocessor (body, hands, and face) and say the improved processor is more accurate, especially for hands. A depth map from a photo of a real hand in the pose you want is another way to pin down where each finger goes.

PhoneDiffusion availability and article scope

PhoneDiffusion runs curated Core ML model packs (SD 1.5, SD 2.1, and SDXL) on supported iPhone and iPad devices with iOS 17 or later; local generation is private and works offline once a pack is downloaded. It also offers optional cloud models, such as FLUX and Seedream, on paid monthly or yearly plans; those are text-to-image only, and the text prompt is sent online to generate the image.

To repair a hand in the app, open the image and choose Inpaint, tap Select area, and paint the hand with the Brush (Brush size and Edge softness adjust the stroke); then describe the replacement and set Replacement strength. Only the painted area changes. If you give a result a thumbs-down and choose ‘Faces, hands, or shapes look wrong’, the app suggests simplifying the pose, trying another variation, and repairing a small area with Inpaint.

Several packs already include terms such as ‘bad hands’ and ‘extra fingers’ in a built-in negative prompt that the app applies for you, and PhoneDiffusion Pro adds a Negative prompt option for your own terms. The app has no ADetailer-style automatic hand detection, no ControlNet or OpenPose input, and no general production importer for arbitrary checkpoints, LoRAs, or ControlNet files; the AUTOMATIC1111, ComfyUI, Diffusers, ADetailer, and HandRefiner steps above describe desktop and server tools.

Field notes

  • Bad hands are a known limitation of Stable Diffusion and SDXL; plan to repair them rather than expecting every generation to be right.
  • Inpaint only the hand with a small margin, and on desktop use Only masked so the hand is redrawn at full resolution.
  • Simple poses, larger hands in the frame, a hand-focused negative prompt, and several seeds lower the error rate but do not remove it.
  • ADetailer automates hand masking and inpainting; HandRefiner and OpenPose ControlNet guide the finger structure itself.

Try it on your phone

  1. Generate a few seeds with a simple, close hand pose and keep the best image.
  2. Mask the bad hand with a little margin around the fingers and wrist.
  3. Describe the hand and its action in the prompt, and keep the original hand as the starting point when its position is right.
  4. Inpaint several times at a moderate strength and keep the attempt with correct fingers.
  5. Repeat on any finger that is still wrong with a smaller mask, then upscale the final image.

Sources and verification

Primary and maintainer documentation checked for this guide. Product-specific details were reviewed against the current PhoneDiffusion scope.