Guide · Open source
How to use hosts: block ads and malware domains with a hosts file
Updated · written with AI from the project's own documentation and checked against our catalogue data
StevenBlack/hosts is an open-source project that merges several curated hosts files into one list with duplicates removed. A hosts file maps domain names to addresses, so domains listed there fail to load on the device that uses the file. This guide explains which variant to pick, where to get the raw file, how to clone the repository, and where hosts-file blocking falls short.
Quick start
- 1Pick a variant. Decide whether you want the base Unified hosts list or one that adds fakenews, gambling, porn or social categories.
- 2Find its raw link. Open the README variant table and copy the raw hosts link for your chosen variant.
- 3Use a mirror if needed. If your hosts file manager cannot use GitHub links, use the Non GitHub mirror link for the same variant.
- 4Clone shallowly if you need the repo. Run git clone --depth 1 ... to fetch only the latest version rather than the full history.
- 5Load the list. Import the raw file into your hosts file manager, or add it to your system's hosts file.
- 6Check the limits. Confirm that domain-level, all-or-nothing blocking meets your needs before relying on it.
What the StevenBlack hosts list does
The repository consolidates several reputable hosts files and merges them into a unified hosts file with duplicates removed. Its base variant, labelled Unified hosts, blocks adware and malware domains.
Because a hosts file maps domain names to addresses, listing an ad or malware domain there makes your computer or network fail to reach it. Blocking happens per domain, so it is all-or-nothing for each one.
- Base variant: Unified hosts, recipe adware + malware, about 76,736 unique entries at the time of the README snapshot.
- Optional extensions: fakenews, gambling, porn and social, alone or in combination.
- Non-base variants are listed in the repository's alternates folder.
Choose the right variant
The README lists 31 variants in addition to the base list. Pick the one that matches the categories you want blocked. Each variant has its own raw hosts link and a readme that describes its contents.
Variants with the word only in their name, such as porn-only, contain just that category without the base ad and malware list. Combined variants, such as Unified hosts + porn, include the base list plus the extension.
- Want ads and malware only? Use the Unified hosts base file.
- Want to add a category filter? Choose a Unified hosts + category variant.
- Want only one category on top of nothing else? Choose a category-only variant.
Get the hosts file
The raw hosts file for each variant is linked from the README's variant table. The base Unified hosts file is also published at a raw GitHub link.
Some hosts file managers do not work with GitHub download links. The README names Hostsman for Windows as an example and points to a Non GitHub mirror column for those tools. Import the raw list into your manager, or copy it into your system's hosts file using the method your operating system uses.
- Use the raw link from the variant table for the variant you chose.
- If your hosts file manager cannot fetch from GitHub, use the Non GitHub mirror link for the same variant.
Clone the repository efficiently
Cloning the full repository can take a long time because it includes its history since 2018. The README advises a shallow clone if you only want the latest version.
Run the command below. The --depth 1 flag limits the clone to the most recent commit.
git clone --depth 1 ...Know the limits of a hosts file
A hosts file only matches domain names. It cannot filter encrypted or app-level traffic in a way that inspects the content of requests, and it gives no per-site or per-user control. Each domain is either blocked or not for the device using the file.
If you need per-user rules, filtering inside one browser, or more control, consider a different tool. The project's comparable projects are Pi-hole, AdGuard Home and uBlock Origin.
- Not per-user or per-site: a domain is blocked for everyone on that device.
- Browser-only ad blocking is simpler with a browser extension such as uBlock Origin.
- Network-wide filtering with more controls is the niche of Pi-hole and AdGuard Home.
Report problems to the right place
The README asks that issues about the content of the produced hosts files go to the data source that contributed the content. Issues about the hosts/data/StevenBlack/hosts file itself belong in this repository.
Contact details for each data source are in the hosts/data/ directory.
What people use it for
- Blocking ad and known malware domains across a home network or single device.
- Adding an optional porn or gambling filter for a household.
- Importing a raw list into a hosts-file manager on Windows.
- Keeping a simple plain-text blocklist without installing extra software.
Frequently asked questions
Is StevenBlack hosts free?
The project is licensed under MIT, according to the README badge and project summary. The source does not list any price, so the license is the main thing to check.
What are the requirements to use it?
The project lists no prerequisites. You need a way to load a hosts file on your device or in your hosts-file manager, and git if you want to clone the repository.
How do I install StevenBlack hosts?
Download the raw hosts file for your chosen variant from the README table and place it in your hosts file, or import it into a hosts-file manager. To clone the repository, use git clone --depth 1 ... as the README recommends.
What is the difference between Unified hosts and the porn or gambling variants?
Unified hosts is the base list of adware and malware domains. Variants like Unified hosts + porn add an extra category on top of that base, while porn-only contains just the porn category.
What are good alternatives to StevenBlack hosts?
The project lists Pi-hole, AdGuard Home and uBlock Origin as comparable projects. Those tools offer more control, such as network-wide management or in-browser filtering, than a plain hosts file.
Why are some sites still loading or hosts file blocking not working?
A hosts file only matches domain names, so it may miss traffic that does not match a listed domain. Check that you loaded the correct raw file, and that your hosts-file manager or operating system is actually applying the file.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
StevenBlack/hosts suits people who want a simple, free text-file blocklist for ads, malware and optional categories across a device or home network. Pick a browser extension or a tool like Pi-hole or AdGuard Home if you need per-site, per-user or more granular control.
Install options & downloads