← Home

How to Block Websites on Windows (2026 Guide)

← All posts

Guide10 min read

Block websites on Windows with the hosts file, LockIn MCP, Microsoft Family Safety, or browser extensions. Step-by-step 2026 guide with troubleshooting.

You sit down at your Windows PC to finish a report, open Edge or Chrome, and ten minutes later you're on Reddit, YouTube, or a news feed you didn't mean to visit. Browser tabs multiply. Notifications pull you sideways. On Windows, the distraction problem is especially stubborn because every app has its own window, every browser has its own extension store, and nothing talks to each other unless you set it up deliberately. If you've searched for a windows website blocker that actually holds, you're not alone — and the fix depends on which layer of the system you block at.

TL;DR — Block Websites on Windows in 4 Steps

The fastest reliable path: (1) Decide whether you need a quick manual block or ongoing AI-managed focus. (2) For manual blocking, edit C:\Windows\System32\drivers\etc\hosts as Administrator and add 127.0.0.1 domain.com lines. (3) For system-level blocking you can control through an AI assistant, run npx -y lockin-mcp install. (4) Flush DNS with ipconfig /flushdns so changes take effect immediately.

Method 1: Edit the Windows Hosts File Manually

The hosts file is the oldest block websites windows technique that still works in 2026. Windows checks this plain-text file before it asks DNS servers for an address. If you map a domain to 127.0.0.1 (localhost), the browser can't reach the real site — every browser on the machine is affected, not just one profile.

Step-by-step: block a site with the hosts file

  1. Press Win + S, search for Notepad, right-click it, and choose Run as administrator. You need elevated rights to save changes.
  2. Open C:\Windows\System32\drivers\etc\hosts (change the file type filter to All Files if the folder looks empty).
  3. Scroll to the bottom and add one line per domain you want to block. Use both the bare domain and the www variant when applicable.
  4. Save the file. Open Command Prompt or PowerShell as Administrator and run ipconfig /flushdns.
  5. Test in a private/incognito window so cached pages don't fool you into thinking the block failed.

Example lines to block Twitter/X and YouTube:

# Block distracting sites on Windows
127.0.0.1 twitter.com
127.0.0.1 www.twitter.com
127.0.0.1 x.com
127.0.0.1 www.x.com
127.0.0.1 youtube.com
127.0.0.1 www.youtube.com

This approach is free, works offline, and applies system-wide. The trade-offs: you maintain the list yourself, you need admin access every time you edit, and a determined user can reopen the file and delete lines. For a deeper explanation of how the file works and why it sits below the browser layer, read what the hosts file is and how blocking works.

When the hosts file is enough

Manual hosts editing fits a small, stable block list — three to ten domains you always want gone during work hours. It's less ideal when your distraction list grows weekly or you want timed sessions without editing files by hand.

Method 2: LockIn MCP — AI-Controlled System-Level Blocking

LockIn MCP is a system-level website blocker for Windows, macOS, and Linux that manages the same hosts-file layer — but through MCP tools your AI assistant can call. Instead of opening Notepad every time you need a focus sprint, you tell Claude, ChatGPT, Poke, or Cursor something like "block social media for two hours" and the daemon applies the block across all browsers.

Install LockIn MCP on Windows

  1. Open Terminal or PowerShell (Node.js 18+ recommended).
  2. Run the one-line installer: npx -y lockin-mcp install.
  3. Follow the full-screen setup: verify your license, choose default sites to block, and connect your MCP client.
  4. Start a focus session from your AI assistant or the LockIn dashboard — blocks apply at the OS level immediately.

What you get that raw hosts editing doesn't provide: scheduled sessions, conversational unblocks for legitimate research, AI agents that can suggest domains to add based on your habits, and blocks that survive browser switches because they live below the browser. LockIn also ships with a background daemon so you aren't manually flushing DNS or reopening admin Notepad every afternoon. For the full architecture — relay, MCP tools, focus sessions — see how LockIn MCP works.

LockIn MCP is desktop-only. If you also need phone blocking, pair it with Screen Time (iOS) or a mobile app from our best distraction blockers roundup. On Windows alone, it's the strongest option when you want enforcement plus AI control without maintaining text files by hand.

Method 3: Microsoft Family Safety and Edge Controls

Microsoft builds website filtering into Windows for family accounts. Microsoft Family Safety lets a parent or account manager set screen time limits, block apps, and filter web content for child accounts linked to a Microsoft family group. It's account-based rather than machine-wide — rules follow the signed-in child profile.

Family Safety web filtering

  1. Go to family.microsoft.com and sign in with your Microsoft account.
  2. Select the family member's profile → Content filtersWeb and search.
  3. Turn on Filter inappropriate websites and searches or switch to Only allow websites for a strict allowlist.
  4. Add specific blocked or allowed URLs under Blocked sites or Allowed sites.

Microsoft Edge built-in controls

Edge includes Family safety settings when a child browses with a supervised account, plus Tracking prevention and Enhance your security on the web under edge://settings/privacy. These reduce ads and risky scripts but don't replace a true domain block. Edge's Kids Mode (where available) limits browsing to an approved set without touching other browsers.

Family Safety and Edge controls work well when one person manages rules for kids or shared PCs. They're weaker for self-blocking adults: switching to an unrestricted Windows profile, installing Firefox, or using a phone hotspot bypasses Edge-only rules. For personal deep work on your own admin account, system-level tools beat account-level filters.

Method 4: Browser Extensions (and Their Limits)

Chrome, Edge, and Firefox extension stores list dozens of site blockers — BlockSite, StayFocusd, LeechBlock NG, and similar. Install one, add your domains, set a schedule, done. Extensions are the fastest setup and require no administrator password.

  • Pros: Free tiers, per-site timers, visual block pages, easy toggles for beginners.
  • Cons: Only affect the browser where they're installed. Incognito mode, a second browser, or uninstalling the extension bypasses them in seconds.
  • Best for: Light habit nudges when you trust yourself not to hunt for workarounds.
  • Not for: High-stakes deadlines, ADHD-friendly enforcement, or blocking across Chrome, Edge, and Firefox simultaneously.

If you've already tried extensions and kept disabling them mid-session, that's a signal to move up the stack — hosts file, LockIn MCP, or a dedicated desktop blocker from the best distraction blockers 2026 list. Extensions teach you what to block; system-level tools make the block stick.

Comparison: Windows Website Blocking Methods

MethodBlocks all browsersAdmin rights neededAI / scheduled sessionsHard to bypassBest for
Hosts file (manual)YesYes, to editNoModerateFree, small static lists
LockIn MCPYesOnce at installYesStrongAI-managed focus on desktop
Microsoft Family SafetyPer supervised accountFamily organizerSchedules for kidsModerateParental control, shared PCs
Edge-only controlsEdge onlyVariesLimitedWeakSupervised child browsing
Browser extensionsOne browserNoSomeWeakCasual habit tracking

Troubleshooting Windows Website Blocks

Can't save the hosts file

Windows protects hosts under System32. Open Notepad (or your editor) as Administrator, not just the file. If your editor still can't save, check whether antivirus or corporate policy locks the file — some managed work laptops block hosts edits entirely.

Changes don't take effect

Run DNS cache flush after every hosts edit:

ipconfig /flushdns

Then hard-refresh the browser (Ctrl + Shift + R) or test in a new InPrivate/Incognito window. Some sites use multiple domains or CDN subdomains — you may need to block more than the main URL (e.g., both reddit.com and old.reddit.com).

Site still loads over HTTPS

A successful hosts block usually shows a connection error, not the real site. If the page loads normally, your line may be malformed (no # comment on the same line as the IP unless intended), saved to a copy like hosts.txt, or overridden by a VPN, custom DNS (1.1.1.1, 8.8.8.8), or a DNS over HTTPS setting in the browser that bypasses the local hosts lookup.

LockIn MCP install issues on Windows

  • Confirm Node.js 18+ with node -v.
  • Run Terminal as Administrator if the installer can't write the daemon service.
  • Allow the app through Windows Defender Firewall when prompted — the local relay needs loopback access.
  • Re-run npx -y lockin-mcp install if the daemon shows disconnected in /health; the installer is idempotent.

When to Use System-Level Blocking vs Extensions

Choose browser extensions when you're experimenting with a short list, you're on a locked-down work machine where you can't edit system files, or a gentle reminder is enough. They're frictionless and reversible — which is both the feature and the bug.

Choose system-level blocking (hosts file, LockIn MCP, or apps like Cold Turkey) when bypassing takes less willpower than working, when you use multiple browsers, or when an AI assistant should start and stop focus sessions from natural language. Developers, students, and remote workers on personal Windows machines benefit most from this layer.

The rule of thumb: if you've disabled your blocker more than twice this week, you're using a tool that's too easy to turn off. Move down the stack — from extension to hosts file to a managed daemon.

For context on how hosts-based blocking compares to network-wide DNS filters and desktop apps, the best system-level website blockers in 2026 roundup walks through the full landscape. The hosts file explainer is worth reading before your first manual edit.

Conclusion: Pick the Layer That Matches Your Willpower

Blocking websites on Windows isn't complicated — the hosts file has done the job for decades. What changed in 2026 is how little friction you need to accept: manual edits for free and permanent blocks, Microsoft tools for family accounts, extensions for light nudges, and LockIn MCP when you want AI to run focus sessions at the system layer without opening Notepad as admin every afternoon.

Start with the method that matches how often your block list changes. Static list → edit hosts once and flush DNS. Growing list plus AI workflow → install LockIn MCP. Kids on a shared PC → Family Safety. Still shopping → compare options in best distraction blockers 2026.

Ready to block at the system level?

Install LockIn MCP in one command and connect your AI assistant: run npx -y lockin-mcp install from the get started guide. Your assistant can block domains, start timed focus sessions, and keep distractions off — across every browser on Windows.

Keep reading

→ Compare LockIn MCP to other blockers

→ Install LockIn MCP

How to Block Websites on Windows (2026 Guide) | LockIn MCP