cloud-ip-ranges:~$

Microsoft 365 logo Microsoft 365 IP Ranges

Download current IP ranges (CIDRs) used by the Microsoft 365 cloud infrastructure.

Provider Information

Total IP Ranges
95
36 IPv4 · 59 IPv6
Last Updated
Total Downloads
25,694

Download Options

Choose your preferred format. All downloads are permalinks that always provide the latest data.

IP Ranges

First 25 of 95 ranges. Download the full list above, or search for a specific IP.

CIDR Type Tag
13.107.6.152/31 ipv4 Exchange Online
13.107.6.171/32 ipv4 Microsoft 365 Common and Office Online
13.107.6.192/32 ipv4 Microsoft 365 Common and Office Online
13.107.9.192/32 ipv4 Microsoft 365 Common and Office Online
13.107.18.10/31 ipv4 Exchange Online
13.107.18.15/32 ipv4 Microsoft 365 Common and Office Online
13.107.128.0/22 ipv4 Exchange Online
13.107.136.0/22 ipv4 SharePoint Online and OneDrive for Business
13.107.140.6/32 ipv4 Microsoft 365 Common and Office Online
20.20.32.0/19 ipv4 Microsoft 365 Common and Office Online
20.190.128.0/18 ipv4 Microsoft 365 Common and Office Online
20.231.128.0/19 ipv4 Microsoft 365 Common and Office Online
23.103.160.0/20 ipv4 Exchange Online
40.92.0.0/15 ipv4 Exchange Online
40.96.0.0/13 ipv4 Exchange Online
40.104.0.0/15 ipv4 Exchange Online
40.107.0.0/16 ipv4 Exchange Online
40.108.128.0/17 ipv4 SharePoint Online and OneDrive for Business
40.126.0.0/18 ipv4 Microsoft 365 Common and Office Online
52.96.0.0/14 ipv4 Exchange Online
52.100.0.0/14 ipv4 Exchange Online
52.104.0.0/14 ipv4 SharePoint Online and OneDrive for Business
52.108.0.0/14 ipv4 Microsoft 365 Common and Office Online
52.112.0.0/14 ipv4 Microsoft Teams
52.122.0.0/15 ipv4 Microsoft Teams

Usage Examples - Blocking Microsoft 365 IPs

Download the IP ranges

# Download with curl
curl -O https://cloud-ip-ranges.com/download/microsoft-365.txt

# Or download with wget
wget https://cloud-ip-ranges.com/download/microsoft-365.txt

Block with iptables (Linux firewall)

# Download and block Microsoft 365 IPs with iptables
wget -O microsoft-365_ips.txt https://cloud-ip-ranges.com/download/microsoft-365.txt
while read ip; do
  iptables -A INPUT -s $ip -j DROP
  iptables -A OUTPUT -d $ip -j DROP
done < microsoft-365_ips.txt

Block with UFW (Ubuntu/Debian firewall)

# Download and block Microsoft 365 IPs with UFW
wget -O microsoft-365_ips.txt https://cloud-ip-ranges.com/download/microsoft-365.txt
while read ip; do
  ufw deny from $ip
  ufw deny to $ip
done < microsoft-365_ips.txt

Block with fail2ban (intrusion prevention)

# Create fail2ban filter for Microsoft 365
sudo tee /etc/fail2ban/filter.d/microsoft-365-block.conf << EOF
[Definition]
failregex = ^.*$
ignoreregex =
EOF

# Create jail configuration
sudo tee /etc/fail2ban/jail.d/microsoft-365-block.conf << EOF
[microsoft-365-block]
enabled = true
filter = microsoft-365-block
action = iptables-allports[name=microsoft-365]
logpath = /tmp/microsoft-365_ips.txt
findtime = 1
bantime = -1
maxretry = 1
EOF

# Download IP list and restart fail2ban
wget -O /tmp/microsoft-365_ips.txt https://cloud-ip-ranges.com/download/microsoft-365.txt
sudo systemctl restart fail2ban

Block with pfSense/OPNsense (FreeBSD firewall)

# Create alias table for Microsoft 365 IPs
# 1. Download the IP list
wget -O microsoft-365_ips.txt https://cloud-ip-ranges.com/download/microsoft-365.txt

# 2. In pfSense/OPNsense web interface:
# - Go to Firewall > Aliases
# - Create new alias named "MICROSOFT-365_BLOCK"
# - Type: Network(s)
# - Import the downloaded file
#
# 3. Create firewall rule:
# - Go to Firewall > Rules > WAN
# - Add rule: Action=Block, Source=MICROSOFT-365_BLOCK

About Microsoft 365 IP Ranges

These IP ranges are sourced directly from Microsoft 365's official feeds and are updated regularly to ensure accuracy. The data includes IPv4 and IPv6 ranges used by Microsoft 365's infrastructure worldwide. Last update was 17 minutes ago.