This article explains how to block an IP address on a Windows or Mac computer.

What to Know

  • In Windows Defender Firewall: Advanced Settings > Inbound Rules > New Rule > Custom. Repeat for Outbound Rules.On Mac: Use Terminal to create a rule in the PacketFilter Configuration file or block the IP address on your network via your router.Block malicious IP addresses to protect your computer from hackers. To block some websites, you may need to block multiple IP addresses.

Can You Block an IP Address?

You can block IP addresses on your computer if you want to deny access to specific websites and services. Some websites use more than one IP address. For example, Facebook has multiple IP addresses, so you’ll need to block them all. Disabling individual IP addresses may be helpful if Facebook isn’t working for you.

You may want to block an IP address to prevent yourself or other users from accessing specific websites. You should also block malicious IP addresses to protect your computer from hackers and bots.

How Do I Block an IP Address From My Computer?

You can block an IP address on a Windows PC using Windows Firewall:

If you want to block an IP address across your entire network, you can block websites on your router and set up parental controls for your network.

  • Find the IP address of a website you want to block.
  • In Windows Search, type Windows Firewall and select Windows Defender Firewall to open it.
  • Select Advanced settings.
  • Select Inbound Rules, then select New Rule.
  • Select Custom, then select Next.
  • Select Next on the next two screens to proceed.
  • Under Which remote IP addresses does this rule apply to, choose These IP Addresses and select Add.
  • Select This IP address or subnet, enter the IP address, and select OK.
  • Add as many IP addresses as you like, then select Next.
  • Select Block the connection, then select Next.
  • Make sure all the boxes under When Do These Rules Apply? are checked and select Next.
  • Give a name and description for the blocked IP address, then select Finish.
  • Select Outbound Rules, then select New Rule and repeat steps 5-11.
  • To unblock the IP address, go to Inbound Rules, right-click the name of the rule you created and select Delete. Go to Outbound rules and do the same.

How to Block an IP Address on Mac

The easiest way to block IP addresses on a Mac is to block them for your entire network via your router. If you want to block an IP address on just your Mac, use the Terminal to create a new rule in your PacketFilter Configuration file:

Find the IP address of a website you want to block.

In Windows Search, type Windows Firewall and select Windows Defender Firewall to open it.

Select Advanced settings.

Select Inbound Rules, then select New Rule.

Select Custom, then select Next.

Select Next on the next two screens to proceed.

Under Which remote IP addresses does this rule apply to, choose These IP Addresses and select Add.

Select This IP address or subnet, enter the IP address, and select OK.

Add as many IP addresses as you like, then select Next.

Select Block the connection, then select Next.

Make sure all the boxes under When Do These Rules Apply? are checked and select Next.

Give a name and description for the blocked IP address, then select Finish.

Select Outbound Rules, then select New Rule and repeat steps 5-11.

To unblock the IP address, go to Inbound Rules, right-click the name of the rule you created and select Delete. Go to Outbound rules and do the same.

  • Open Terminal and enter the following to open the PacketFilter Configuration file:
  • $ sudo vim /etc/pf.conf
  • Enter the following, replacing IP address with the address you want to block (for example, 69.63.176.13):
  • block drop from any to IP ADDRESS
  • To block a range of addresses, replace any with an IP address. For example:
  • block drop from 66.220.144.0 to 66.220.159.255
  • Enter the following to enable the packet filter and load the rule you created:
  • $ pfctl -e -f /etc/pf.conf
  • The IP address is blocked. To disable the rule, enter this command:
  • $ pfctl -d

Open Terminal and enter the following to open the PacketFilter Configuration file:

$ sudo vim /etc/pf.conf

Enter the following, replacing IP address with the address you want to block (for example, 69.63.176.13):

block drop from any to IP ADDRESS

To block a range of addresses, replace any with an IP address. For example:

block drop from 66.220.144.0 to 66.220.159.255

Enter the following to enable the packet filter and load the rule you created:

$ pfctl -e -f /etc/pf.conf

The IP address is blocked. To disable the rule, enter this command:

$ pfctl -d

  • How do I hide my IP address?
  • To hide your IP address from websites and your internet provider, set up a virtual private network (VPN). With a VPN, you can browse the web without giving away your identity, location, or data.
  • How do I find my IP address?
  • There are websites that can help you find your IP address. You can also use the ipconfig command in Windows Command Prompt or ifconfig command in the Mac Terminal.
  • How do I change my IP address?
  • To change your IP address on Windows, go to Control Panel > Network and Sharing Center > Change adapter settings. On Mac, go to System Preferences > Network > Advanced > TCP/IP > Manually.

To hide your IP address from websites and your internet provider, set up a virtual private network (VPN). With a VPN, you can browse the web without giving away your identity, location, or data.

There are websites that can help you find your IP address. You can also use the ipconfig command in Windows Command Prompt or ifconfig command in the Mac Terminal.

To change your IP address on Windows, go to Control Panel > Network and Sharing Center > Change adapter settings. On Mac, go to System Preferences > Network > Advanced > TCP/IP > Manually.

Get the Latest Tech News Delivered Every Day