Repolode
StevenBlack

StevenBlack/hosts

A curated, de-duplicated hosts file that merges several public blocklists to block ads, trackers, malware, and optional categories on any OS.

Open-source alternative to:NextDNSAdGuard

Stars
31,277
Forks
2,446
Open issues
161
Last commit
15 hours ago

What is it?

This project combines several well-maintained hosts file sources into one unified hosts file with duplicates removed. The base file covers adware and malware, and it can be extended with optional categories for fake news, gambling, porn, and social media. Each combination is published as a ready-to-use file, so you can pick the variant that matches your needs.

A hosts file maps domain names to IP addresses on your own machine, and the operating system checks it before DNS. Pointing unwanted domains to 0.0.0.0 blocks them at the system level, which works across browsers and apps. The generator is a Python script that can fetch updates from the sources, apply a whitelist or custom blacklist, and write output in standard, compressed, or one-domain-per-line formats.

The repository also offers a container image and a Google Colab option for generating the file. It documents how to apply the file on Windows, macOS, Linux, Android, and NixOS, and lists third-party hosts managers.

Key features

  • 01Merges several curated hosts sources and removes duplicate domains.
  • 02Offers optional extensions for fakenews, gambling, porn, and social media.
  • 03Provides prebuilt variants for every extension combination.
  • 04Includes a Python generator with whitelist, custom blacklist, and output formatting options.
  • 05Supports Docker, local Python, and Google Colab for generating the file.
  • 06Includes scripts and notes for Windows, and a NixOS module.

Use cases

  • Blocking ads and trackers across all devices on a home network or a single PC.
  • Filtering malware and scam domains without installing extra software.
  • Enabling category filters such as porn or gambling blocking for a household or organization.
  • Automating weekly updates of a blocklist with a cron job or container.

Topics

FAQ

What is hosts?
A curated, de-duplicated hosts file that merges several public blocklists to block ads, trackers, malware, and optional categories on any OS. This project combines several well-maintained hosts file sources into one unified hosts file with duplicates removed. The base file covers adware and malware, and it can be extended with optional categories for fake news, gambling, porn, and social media. Each combination is published as a ready-to-use file, so you can pick the variant that matches your needs.
Is hosts free to use? What license does it have?
hosts is open source under the MIT license. Check the license terms before using it in commercial products.
Is hosts still maintained?
Actively maintained. The last commit to hosts was on Oct 20, 2026.
What can I use hosts for?
Blocking ads and trackers across all devices on a home network or a single PC. Filtering malware and scam domains without installing extra software. Enabling category filters such as porn or gambling blocking for a household or organization. Automating weekly updates of a blocklist with a cron job or container.
Where can I get hosts?
The source code and installation instructions are on GitHub: https://github.com/StevenBlack/hosts

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects