Get the base resolution for hires.fix right
Hires.fix gives Stable Diffusion images their crisp, high-resolution look — but only if the base resolution of the first pass lands in the model’s trained sweet spot. Set it too high and you get duplicated heads and warped bodies; too low and the upscale looks soft. This calculator takes the final size you want and an upscale factor and tells you exactly what base resolution to generate at, plus a VRAM sanity check.
How the hires.fix math works
Hires.fix is a two-pass pipeline:
- Base pass — generate at a resolution close to the model’s native size (≈512px for SD 1.5, ≈1024px for SDXL).
- Upscale + refine — multiply by the upscale factor and run a short img2img pass to paint in detail.
So the relationship is simply:
base_width = target_width / upscale_factor
base_height = target_height / upscale_factor
The trick is choosing an upscale factor that lands the base size near the model’s native resolution. If you want 2048×2048 from SDXL, a 2× factor gives a 1024×1024 base — perfect. The same target on SD 1.5 would want a ~3× factor to keep the base near 680px.
Tips to avoid out-of-memory and artifacts
- Stay near native. Keep the base long edge within roughly ±50% of the model’s native resolution.
- Watch VRAM on the second pass. The upscaled pass operates at full target resolution — that is where most cards run out of memory. Enable tiled VAE if the estimate is tight.
- Use a low hires denoising. 0.3–0.5 adds detail without changing the composition the base pass established.
- Multiples of 8. Both base and target dimensions should be divisible by 8; the calculator rounds for you.