[Beginner's Guide] How to install Stable Diffusion on Windows (AUTOMATIC1111)
We will go through how to download and install the popular Stable Diffusion software AUTOMATIC1111 on Windows step-by-step.
Stable Diffusion is a text-to-image AI that can be run on a consumer-grade PC with a GPU. After this tutorial, you can generate AI images on your own PC.
Your PC should run Windows 10 or higher with a discrete Nvidia video card (GPU) with 4 GB VRAM or more. An integrated GPU will not work.
If your PC does not meet these requirements, alternatives are
Cloud service – Google Colab. Mac Apple Silicon M1/M2.【1.2】
Step 1: Install python
You will need Python 3.10.6. There are two ways to install Python on Windows
Option 1: Install from the Microsoft store.
I recommend installing it from the Microsoft store.
First, remove all Python versions you have previously installed. You can do that in Control Panel → Add or remove programs.
Visit Python 3.10 on Microsoft Store and install the Python software.
This step is most likely to go wrong. Let’s do a check.
Press the Windows key on your keyboard and type “cmd” to find a program called “Command Prompt”.
Open the Command Prompt App. You should see a black terminal like you are a hacker…
Type “python” and press Enter. You should see you see it prints out Python 3.10. This tells you your Python is installed correctly.
Now you can close the Command Prompt App.
Don’t proceed to the next step until you get Python 3.10 installed correctly.
If you don’t see Python 3.10 running, try
Restarting the PC Removing all the previous versions of Python and reinstalling from the Microsoft Store If the one from Microsoft Store doesn’t work for you, remove it and try the one on the Python website.
Step 2: Install git
Git is a code repository management system. You will need it to install and update AUTOMATIC1111.
Go to this page to download the windows version.
Open the installer. Click Install to accept the license and install the software.
Follow the instruction to complete the installation.
Step 3: Clone web-ui
This step downloads the Stable Diffusion software (AUTOMATIC1111).
Press the Window key (It should be on the left of the space bar on your keyboard), and a search window should appear. Type
Click on Command Prompt. The command prompt window would show up.
First, make sure you are in your home folder by typing the following command and then pressing Enter. (Tip: You should be able to use right-click to paste in Command Prompt.)
You should see your prompt shows something like
Next type the following command and press Enter to clone the AUTOMATIC1111 repository.
A folder called
stable-diffusion-webui should be created in your home directory.
It’s ok to clone the repository in a different folder instead of
%userprofile%, as long as you can find the newly created
stable-diffusion-webui folder. You will need to change the folder location accordingly in the following steps.
Step 4: Download a model file
Next, go to the newly created folder in File Explorer. Put in
in the address bar and press enter.
Navigate to the folder models and then Stable-diffusion. You should see a file Put Stable Diffusion checkpoints here.txt like below.
Step 5: Run webui
Now in File Explorer, go back to the
stable-diffusion-webui folder. That is, go back up two levels or type
again in the address bar.
Find a file called
webui-user.bat. Double-click to run and complete the installation.
This last step is going to take a while. When it is done, you will see a message
Running on local URL: http://127.0.0.1:7860
like the one below.
n your web browser, go to the URL
You should see the AUTOMATIC1111 webui! Put in a prompt (e.g. “a cat”) and hit Generate to test if Stable Diffusion is running correctly.
When you are done using Stable Diffusion, close the
cmd black window to shut down Stable Diffusion.
To rerun Stable Diffusion, you need to double-click the
You can speed up Stable Diffusion with the
--xformers option. If you have less than 8 GB VRAM on GPU, it is a good idea to turn on the
--medvram option to save memory to generate more images at a time.
To enable them, right-click on the file
webui-user.bat and select Edit. (You may need to select “Show More Options” first if you use Windows 11).
Replace the line
Save and close the file.
webui-user.bat file to run Stable Diffusion.
Use the argument
--gradio-img2img-tool color-sketch to enable the color sketch tool, which could be helpful in img2img.
If you want to use the computer as a server and access the GUI with another computer, use the argument
--listen to enable a connection from another computer. You will need to set the firewall appropriately on the server, and this is beyond the scope of this installation guide.
That’s it! I hope you will have fun making AI images.
If you are new to Stable Diffusion, check out the Quick Start Guide for some quick tips to use Stable Diffusion.
Head to our beginner’s series to learn Stable Diffusion step by step.
Check out this prompt generator for building high-quality prompts.
RTX 4000 series graphic cards
Good news for you if you use RTX 4070, RTX 4080 or RTX 4090 Nvidia graphic cards. The latest version of AUTOMATIC1111 supports these video card. (with torch 2.0 and cuda 11.8)
I will provide a benchmark speed so that you can make sure your setup is working correctly. The settings are:
batch size: 4 batch count: 10 Image size: 512×512 Sampling steps: 20 Sampling method: Euler a Model: SD v1.5
Using a batch size of 1 is not recommended, as the measured speed is likely to be highly dependent on other components on your system.
You should see the speed of generating each image. Pick a stable value, usually in the middle like the 5th batch. The speed is in it/s (iterations per second).
You should get about 10 its/s on RTX 4090. (Note that this is 4 images per iteration) This is the max speed you can get nowadays.
You can use one of the following speed-up parameters.
Option 2 is slightly faster, but test them out to see what works best for you.
By default, your copy of AUTOMATIC1111 won’t be automatically updated. Given how fast things are moving, you will likely need to update your copy at some point to use the latest and the coolest.
There are two options for updating it. (1) Updating every time when you run it, and (2) Updating only when needed.
Updating every time you run
To update whenever you run webui, edit the file
webui-user.bat. Add “git pull” before the line calling webui.bat. The file should look something like
From now on, webui will update itself every time it starts.
Updating as needed
It may not be a good idea to use the latest version because something could be broken. Updating periodically or only if you need a new feature is a more prudent approach.
To update the webui, open Command Prompt (cmd) and go to webui’s directory using the command below. (You will need to change
%userprofile% if you installed it somewhere else.)
And run the command
If git pull shows an error, it is usually because you have accidentally changed some files. You can reset the webui folder with the following two commands.
And then run git pull again.
Note that all files will be reset. You will need to make changes to
Reverting back to a previous version
Sometimes the latest version of webui is broken, and you don’t want to use it. You can revert back to a previous version by following the instructions below.
Step 1: Go to this page to view previous versions. Each row is a previous version.
Step 2: Pick a previous version you want to revert back to. You can look at the date and comment to make a judgment.
Step 3: Press the copy button to copy the hash code of the version.
Step 4: In the command prompt, run the following commands. The hash code (highlighted below) is just an example. You will paste the one you just copied.
If you see errors, reset the webui (see the previous section) and retry.
Web options to run AUTOMATIC1111
Consider the following options for running Stable Diffusion without installing it locally.
(I earn a small commission if you subscribe.)
Graviti Diffus lets you use AUTOMATIC1111 without having a GPU. The service is provided remotely.
Frequently Asked Questions
Does it work on AMD GPU? No, you have to have an NVIDIA GPU.
How to resolve NaN errors when generating images?
--no-half argument to webui-user.bat
How to resolve out-of-memory errors?
--low-vram instead of
--med-vram argument in webui-user.bat
Is there an easier way to install AUTOMATIC1111? The above is the official install instructions. Two alternatives:
Recently they started to tag release builds. They are supposed to work after downloading and unzipping. There’s an unofficial easy installer for Windows you can try.
I tried everything, but it still does not work. You can use Google Colab to run AUTOMATIC1111. This is what I use. The notebook launches AUTOMATIC1111 with one mouse click.
To see more content about Stable Diffusion from zero click:https://www.hayo.com/article/64c21001ef669957a0d21e63