How to filter multiple IP addresses (with a single filter) in Google Analytics

When setting up Google Analytics for a client, one of the first things I do is create an ‘Internal Traffic Filter’. For sites with low traffic volumes, it’s imperative to have the most accurate data possible – so removing internal traffic from you and your client will help.

To begin filtering out internal hits from you and your client, you will need to ensure that both parties have a Static IP address(es) that you can specifically target with a filter.

Filters can be applied at the ‘View’ Level of your individual accounts within Google Analytics. Any data or hits that are excluded by a filter cannot be recovered later, so it’s best practice to keep an unfiltered view of your data too.


Select the Property View that you wish to apply the Internal Traffic Filter to.

Filtering a Single IP Address

As an example, If all internal traffic from your agency comes from a sole IP, filtering hits from this location is relatively straight forward. Follow the steps in the diagram below to create a new filter that will exclude hits from the IP that you specify.


Filtering Multiple IP Addresses

Let’s say however you also wanted to filter out your client’s office’s internal traffic, but they access the site from three completely different IP addresses. You could set-up three separate filters, but for the sake of simplicity and best practice; it’s possible to specify these within a single filter pattern using a Custom Filter and a regular expression for the Filter Pattern:


As you can see in the diagram above, multiple IP addresses can be separated with pipes (|), but it’s important to precede each dot with a backslash so that it’s treated as a regular full stop.

It’s as simple is that. Be sure to test that your filters are working correctly by heading over to Real Time Analytics within reporting to ensure your activity is not being recorded.

  • Vivekanand Selvaraj

    #James – This article really great, It resolve my questions about filtering Local IP.

  • Why we need to filter ips???

    • If you wish to exclude traffic from yourself (either the marketing agency or the client) to ensure that all data is the general public accessing the website. Optional of course.

  • Cracking article James, Didn’t have a clue you could filter multiple IP’s using regular expressions. Will be using this method going forward!

  • Marc B

    Hey James,

    I’m not used to regular expression. This article here

    from google shows a more complex expression. Why is that?

    • Hi Marc, in that example Google are showing you how to filter a range of IP addresses. For example > so that you’d also capture the ranges in-between 1 and 5 like Hope that makes sense?

  • Hi. Can you upload a list of IP addresses to exclude. I have a new client who has 4500 employees all over the world and it is skewing the data big time!

    • I don’t think you can upload a list of IPs sadly. Unless they have a common pattern that you can target with a regular expression, I don’t think there’s an easy way of blocking their IPs. Are the employees logged into the site at all when they access it? You could consider removing analytics tracking for those sessions if they can be identified as employees whilst browsing the site?

  • Peter

    I set up the filter to filter out my visits from my static IP addres, but when I go to Real Time Analytics, it’s showing that my visit to the website in real time. Does that mean that the filter is not working properly?

    • If it’s definitely your IP showing in the realtime, and it’s still happening now – then it would suggest the filter isn’t set-up correctly or applied to the correct view? IT may be worth double checking your IP and that the filter is applied to the correct view within Analytics.

      • Laurentiu Bancu

        I have the same problem. The filter is set up correctly (we have a fixed IP address), it has been applied to all views, but in Real Time analytics is showing traffic from our IP. What can be wrong?

        • Alex Davison

          Hi, late response here but better late than never I guess.
          Real Time is not affected by filters, so will continue to show your traffic. The filter will only affect the standard and custom reports.

          • SANKET BHATKAR

            In Which standard Reports can i check whether the filter was successful ?

  • Milosz_Krasinski

    Thank You for that James. This post really sorted my problem. Would be useful to find out solution for Nolan’s 4K IP’s question.

    • Thank you Milosz, great to hear that this has helped with your traffic filtering. I’ve just replied to Nolan’s question if that helps.

  • Thanks for providing this information. I also used this information from our site for block our office ip addresses.

  • Brian Sorce

    What if you have over 1,000 ips? The character amount allowed is only 255?

    • Hi Brian, are you not able to write a regular expression to catch them in an easier way? i.e. if there are any aspects of the 1000’s of I.Ps that are shared, you can do a pattern match?

      • Courtney Jordan

        I have the same problem – I have well over 600 chars in my office ips and only a few that can be matched at even the second level (210.24, for ex). I believe that’s still not specific enough to only trap internal traffic. We want to view all, external, and internal. But have international company with offices worldwide and lots of remote employees. Any ideas would be greatly appreciated!

        • Marco Peters

          I am having the same problem. 480 characters.

          • Daniel Eddington

            Cut them in half and create two different filters..? Seems pretty obvious to me.

          • Yep, that’s what has to be done.

  • Monabelle Salaan

    Followed Format #6. It’s not working, it said “Invalid IP address”.

    • Anton Hilton

      You need to click on ‘custom’, which is next to ‘predefined’ and then follow this process.

      • Jason Flaherty

        This was really helpful! Thanks!

  • Lindsay

    Do you need a static ip address to create a filter? Can you google what your IP address is or do you have to create one manually?

    • Alex Davison

      If you google “What is my IP” google usually now responds with the answer, however if it doesn’t there are plenty of sites that can help. If you don’t have a static IP then you can’t guarantee that this will work indefinitely; however I have found in practice that even dynamic IPs rarely change on fixed broadband links.

  • Do you know if the multiple IP address filtering method will work for IPv6 too?

  • Katra

    I’d like to exclude my office IP addresses and we share the first 7 numbers of our IP addresses will it work if I just use the first 7 numbers instead the complete IP

  • adlabs Ideatelabs

    Thanks, this was a really helpfull article.

  • Анна

    This didn’t work for me. GA says “Invalid IP address” when I try to separate IPs with pipes ((

    • Nomy

      hi, the correct regex to exclude multiple ip addresses would be ^$|$.

      • Nadica

        Either the one nor the other work for me. Invalid IP address ..:S

        • Nomy

          sorry my mistake, the correct regex would be ^|$

    • Are you sure you changed the filter type to ‘Custom’ rather than leaving it on the predefined IP filter?

      • Bharti Yadav

        Hi, I have excluded range of ip addresses but conversions are being tracked..Don’t know why..What could be the region?

  • Lionel

    Hi! I’m looking to exclude the following IP range – to I came up with this regexp, 216.82.2[45]..[0-9]+ – but it doesn’t seem to work. Don’t see where I’m doing wrong… could you help me on that? thanks!

    • Tanner Legasse

      Hmm, it’s a little more complex than that (though I wish it weren’t).
      What you’re looking for is this:
      Notice the third group of numbers. We have a capture group that handles the 40 series numbers or the 50 series numbers.
      Since we want to capture at least one of these, I used a plus (+) sign.
      Now the last one is a little more straight forward.
      All we needed to do was specify that we want at least one of the capture group, but no more than 3, and we are allowing 0-9.
      Technically this would match 000 or 100 or 010, but who really cares lol. You could write it differently if you wanted, it would probably just involve a negative lookbehind.

  • Thank you so much for this article, it really helped!