If you have a collection of wallpapers saved to Favorites on Wallhaven and want to download them in bulk, you will notice that there is no built-in way to do so from the website itself. There also aren't any tools currently available to do it either. Which means you'll have to use a little script to do it all for you. Before you start, this process is specifically for Windows users using Google Chrome. If you are using Firefox, check out the Firefox version of this guide instead. The process is quite simple, but the download will take quite a long time if you have a big collection, so keep that in mind.

Takeaways:

  1. Is there a way to download all of the wallpapers you added to favourites in Wallhaven?
  2. How do you download everything from your Wallhaven Favorites library using Google Chrome?

Before you Start Downloading your Wallhaven Favourites

This process can take a long time, especially if you have a large Favorites collection, since the downloader needs to do all of the following things:

  • Check every page of your Favorites.
  • Visit each individual wallpaper page.
  • Find the original image.
  • Download the image.
  • Respect Wallhaven's rate limits by slowing down when necessary.

Once the script starts running, it will restart automatically if the internet drops out. However, if you close the PowerShell window, you will have to start all over again. If you restart the script again, it shouldn't redownload everything it has already downloaded. But you might want to double-check just in case you end up with 2 of everything.

1. Install Python

Download and install Python for Windows. If you don't already have Python:

  • Open PowerShell (as admin)

  • Run:

winget install Python.Python.3.13

how to download your favorites from wallhaven using google chrome

  • Close and reopen PowerShell.
  • Then check that Python is installed:

py --version

If you see a Python version, Python is ready.

2. Create a folder

  • Open File Explorer and create a folder where you will keep the downloader.

For example:

C:\Users\YourName\Downloads\Wallhaven Collection

3. Create the downloader script

  • Inside the folder, open Notepad and create a new text document called:

wallhaven_favorites.py

  • Make sure the file ends in .py, not .txt.
  • Open the file with Notepad and paste the following script:

import os

import re

import sys

import time

import requests

import browser_cookie3

from bs4 import BeautifulSoup

from urllib.parse import urljoin


BASE_URL = "https://wallhaven.cc"

FAVORITES_URL = f"{BASE_URL}/favorites"

DOWNLOAD_DIR = os.path.join(

os.path.expanduser("~"),

"Pictures",

"Wallhaven Favorites"

)

REQUEST_DELAY = 1.0


def create_session():

print()

print("=" * 70)

print("WALLHAVEN FAVORITES DOWNLOADER")

print("=" * 70)

print()

print("Reading your Chrome Wallhaven login session...")

print()

try:

cookies = browser_cookie3.chrome(

domain_name="wallhaven.cc"

)

except Exception as e:

print()

print("Could not read Chrome cookies.")

print()

print("Make sure Chrome is installed and")

print("that you are logged into Wallhaven.")

print()

print("If Chrome is currently open, completely close")

print("Chrome and run the script again.")

print()

print("Error:", e)

sys.exit(1)

if not cookies:

print()

print("No Wallhaven cookies were found.")

print()

print("Open Chrome, log into Wallhaven,")

print("visit https://wallhaven.cc/favorites,")

print("and run this script again.")

sys.exit(1)

session = requests.Session()

for cookie in cookies:

session.cookies.set(

cookie.name,

cookie.value,

domain=cookie.domain,

path=cookie.path

)

session.headers.update({

"User-Agent": (

"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "

"AppleWebKit/537.36 (KHTML, like Gecko) "

"Chrome/140.0 Safari/537.36"

)

})

return session


def request(session, url, **kwargs):

for attempt in range(5):

try:

response = session.get(

url,

timeout=30,

allow_redirects=True,

**kwargs

)

if response.status_code == 429:

wait = 10 * (attempt + 1)

print(

f"\nRate limited. Waiting {wait} seconds..."

)

time.sleep(wait)

continue

response.raise_for_status()

return response

except requests.RequestException as e:

if attempt == 4:

raise

print()

print("Request failed:", e)

print("Retrying...")

time.sleep(5)

raise RuntimeError("Request failed.")


def get_favorite_pages(session):

print("Checking your Favorites...")

response = request(

session,

FAVORITES_URL

)

soup = BeautifulSoup(

response.text,

"html.parser"

)

links = soup.select('a[href*="/w/"]')

if not links:

print()

print("No wallpapers were found.")

print()

print("Make sure you are logged into Wallhaven")

print("in Chrome and can see your Favorites.")

print()

sys.exit(1)

pages = {1}

for link in soup.select("a[href]"):

href = link.get("href", "")

match = re.search(

r"[?&]page=(\d+)",

href

)

if match:

pages.add(int(match.group(1)))

max_page = max(pages)

print(f"Detected {max_page} page(s).")

return max_page


def extract_wallpaper_urls(html):

soup = BeautifulSoup(

html,

"html.parser"

)

urls = set()

for link in soup.select('a[href*="/w/"]'):

href = link.get("href", "")

match = re.search(

r"/w/([A-Za-z0-9]+)",

href

)

if match:

wallpaper_id = match.group(1)

urls.add(

f"{BASE_URL}/w/{wallpaper_id}"

)

return sorted(urls)


def get_original_image(session, wallpaper_url):

response = request(

session,

wallpaper_url

)

soup = BeautifulSoup(

response.text,

"html.parser"

)

image = soup.select_one(

"img#wallpaper"

)

if image and image.get("src"):

return urljoin(

BASE_URL,

image["src"]

)

og = soup.select_one(

'meta[property="og:image"]'

)

if og and og.get("content"):

return urljoin(

BASE_URL,

og["content"]

)

return None


def safe_filename(filename):

return re.sub(

r'[<>:"/\\|?*]',

"_",

filename

)


def download_image(session, image_url, wallpaper_id):

os.makedirs(

DOWNLOAD_DIR,

exist_ok=True

)

filename = image_url.split("/")[-1]

if not filename:

filename = f"wallhaven-{wallpaper_id}.jpg"

filename = safe_filename(filename)

path = os.path.join(

DOWNLOAD_DIR,

filename

)

if (

os.path.exists(path)

and os.path.getsize(path) > 0

):

return "exists"

for attempt in range(5):

try:

with session.get(

image_url,

stream=True,

timeout=60,

headers={

"Referer": BASE_URL + "/"

}

) as response:

if response.status_code == 429:

wait = 10 * (attempt + 1)

print(

f"\nRate limited. "

f"Waiting {wait} seconds..."

)

time.sleep(wait)

continue

response.raise_for_status()

temp_path = path + ".part"

with open(

temp_path,

"wb"

) as f:

for chunk in response.iter_content(

chunk_size=1024 * 1024

):

if chunk:

f.write(chunk)

os.replace(

temp_path,

path

)

return "downloaded"

except requests.RequestException as e:

if attempt == 4:

print(

f"\nFAILED: {wallpaper_id}: {e}"

)

return "failed"

time.sleep(5)

return "failed"


def main():

session = create_session()

print("Chrome session loaded.")

print()

print("Download directory:")

print(DOWNLOAD_DIR)

print()

max_page = get_favorite_pages(session)

all_wallpapers = []

print()

print("Collecting wallpaper IDs...")

print()

for page in range(1, max_page + 1):

url = FAVORITES_URL

if page > 1:

url += f"?page={page}"

print(

f"Reading page {page}/{max_page}...",

end="",

flush=True

)

try:

response = request(

session,

url

)

wallpapers = extract_wallpaper_urls(

response.text

)

print(

f" {len(wallpapers)} wallpapers"

)

all_wallpapers.extend(wallpapers)

except Exception as e:

print(f" ERROR: {e}")

time.sleep(REQUEST_DELAY)

all_wallpapers = list(

dict.fromkeys(all_wallpapers)

)

print()

print("=" * 70)

print(

f"Found {len(all_wallpapers)} "

f"favorite wallpapers."

)

print("=" * 70)

print()

downloaded = 0

skipped = 0

failed = 0

for number, wallpaper_url in enumerate(

all_wallpapers,

1

):

wallpaper_id = (

wallpaper_url

.rstrip("/")

.split("/")[-1]

)

print(

f"[{number}/{len(all_wallpapers)}] "

f"Wallpaper {wallpaper_id}...",

end="",

flush=True

)

try:

image_url = get_original_image(

session,

wallpaper_url

)

if not image_url:

print(" NO IMAGE FOUND")

failed += 1

continue

result = download_image(

session,

image_url,

wallpaper_id

)

if result == "downloaded":

downloaded += 1

print(" downloaded")

elif result == "exists":

skipped += 1

print(" already exists")

else:

failed += 1

print(" FAILED")

except Exception as e:

failed += 1

print(f" ERROR: {e}")

time.sleep(REQUEST_DELAY)

print()

print("=" * 70)

print("DONE")

print("=" * 70)

print()

print(f"Downloaded : {downloaded}")

print(f"Skipped : {skipped}")

print(f"Failed : {failed}")

print()

print("Files are in:")

print(DOWNLOAD_DIR)

print()


if __name__ == "__main__":

main()

Save the file after pasting the script.

4. Install the required packages

  • Open PowerShell and run:

py -m pip install requests beautifulsoup4 browser-cookie3

  • Wait for the installation to finish.

The browser-cookie3 package supports Chrome on Windows and can load Chrome's cookies into Python so the downloader can use your existing Wallhaven login session.

5. Log in to Wallhaven

  • Open Google Chrome and log in to your Wallhaven account.
  • Open: https://wallhaven.cc/favorites
  • Make sure your Favorites are visible.
  • Once you have confirmed that you can see your Favorites, close Chrome completely.

This is important because Chrome may lock its cookie database while it is running. If Python cannot access the cookie database, the script will report a PermissionError. You do not need to log out of Wallhaven. Simply close Chrome.

6. Start the downloader

  • With Chrome closed, open PowerShell and go to the folder containing the script.

For example:

cd "C:\Users\YourName\Downloads\Wallhaven Collection"

  • Then run:

py wallhaven_favorites.py

The script will attempt to read your existing Chrome Wallhaven session and begin scanning your Favorites.

You should see something similar to:

Reading page 1/50... 24 wallpapers

Reading page 2/50... 24 wallpapers

Reading page 3/50... 24 wallpapers

Once all the pages have been checked, it will begin downloading the wallpapers.

How to Download All Your Wallhaven Favorites (Chrome)

Important: Leave Chrome closed while the downloader is running. The script does not need Chrome to remain open because it has already loaded the required login cookies.

7. It's going to take ages to download everything!

If you have a big collection of wallpapers, it is going to take a very, very long time to download. My 12,000-image collection took half a day with 1 GB fibre up/down. Wallhaven limits how frequently requests can be made, and the script deliberately slows down between requests. If the server returns a rate-limit response, the script waits before trying again. On average, it will download 10-15 wallpapers at a time, then stop for 10-20 seconds before restarting. There is nothing you can do about this.

  • Do not close the PowerShell window while the script is running.
  • You can safely leave it running in the background.
  • If the process is interrupted, you can run the script again.
  • The downloader checks whether each image already exists and skips files that have already been downloaded.

For example, if the first run downloads 5,000 images and then your PC restarts, run:

py wallhaven_favorites.py

again. The previously downloaded files will be reported as already existing, and the script will keep working through the collection.

Download All Your Wallhaven Favorites (Chrome)

8. Find your downloaded wallpapers

The wallpapers are automatically saved to:

C:\Users\YourName\Pictures\Wallhaven Favorites

You can open this folder at any time to see the wallpapers that have already been downloaded.

Remember that Chrome should remain closed while the script is running. PowerShell, however, must remain open because it is running the downloader.

For a very large collection, make sure you have enough free storage space. Thousands of high-resolution wallpapers can easily consume tens of gigabytes.

Once the process is complete, you should see something similar to:

Downloaded : 11938
Skipped : 0
Failed : 0

The exact numbers will depend on your collection.

How to Download All Your Wallhaven Favorites guide

Uninstalling Everything After the Download

Once you have finished downloading your collection, you can uninstall the Python packages if you don't think you will need them again.

Run:

py -m pip uninstall requests beautifulsoup4 browser-cookie3

Python itself can be removed from Windows through Settings > Apps > Installed apps in the same way as other Windows applications.

You can also leave Python and the packages installed if you think you might want to run the downloader again later.