Quick answer
IP anonymization (IP truncation or masking) zeroes the last part of an IP address, such as the final byte of IPv4 or the last 80 bits of IPv6, before it is stored or looked up. It lowers precision. Whether the result is still personal data depends on what else can identify the person.
Is an IP address personal data?
Often yes, in EU and UK law, but the answer is a test rather than a label. The GDPR defines personal data as information relating to an identified or identifiable person and lists an "online identifier" among the ways to identify one (Article 4(1)). Recital 30 names internet protocol addresses as an example of such identifiers. Recital 26 then sets the test: look at all the means reasonably likely to be used to identify the person, taking into account the cost and time involved.
The Court of Justice applied that test in Breyer (C-582/14, 19 October 2016). A website operator stored the dynamic IP addresses of its visitors. The Court held that a dynamic address is personal data for that operator when the operator has legal means to identify the visitor with additional data that the internet provider holds about that person. In short, an address is personal data when someone can reasonably link it to a human, and the internet provider's subscriber records are one such link.
This page explains the technique and cites the texts. It is not legal advice; whether your own data counts as personal data is a question for your data protection officer or counsel.
What IP anonymization means
IP anonymization, also called IP truncation or IP masking, sets the last part of an IP address to zero before the address is stored or used further. An IPv4 address has four bytes, so the usual setting zeroes the last one or two. An IPv6 address is cut to a prefix, such as the first 64, 56 or 48 bits.
Google's legacy Universal Analytics documentation is a clear public example: with its IP masking option on, the last octet of an IPv4 address is set to zero (12.214.31.144 becomes 12.214.31.0) and the last 80 of the 128 bits of an IPv6 address are zeroed, in memory, before anything is written to disk.
The name is generous. What the technique does is reduce precision, and the result is a coarser address. Whether that coarser address still points at a person is a separate question, covered below. For the general idea of making data non-identifiable, see anonymization; for the weaker, reversible-with-extra-information version, see pseudonymization.
Worked example: what truncation leaves behind
Sample data: one visitor with the documentation-range addresses 203.0.113.42 (IPv4) and 2001:db8:4a2b:7c10:a1b2:c3d4:e5f6:1 (IPv6). The second column is the address that remains; the third counts how many addresses share that truncated value.
| Setting | Address kept | Addresses that look the same |
|---|---|---|
| IPv4, no truncation | 203.0.113.42 | 1 |
| IPv4, last 1 byte zeroed | 203.0.113.0 | 2^8 = 256 |
| IPv4, last 2 bytes zeroed | 203.0.0.0 | 2^16 = 65,536 |
| IPv6, no truncation | 2001:db8:4a2b:7c10:a1b2:c3d4:e5f6:1 | 1 |
| IPv6, keep /64 | 2001:db8:4a2b:7c10:: | 2^64 (about 1.8 × 10^19), one subnet |
| IPv6, keep /56 | 2001:db8:4a2b:7c00:: | 256 subnets of /64 |
| IPv6, keep /48 | 2001:db8:4a2b:: | 65,536 subnets of /64 |
Each step multiplies the crowd by 256 for IPv4, but a bigger crowd only helps if real people fill it. A block of 256 addresses on a university network may hold hundreds of active users. A block on a small regional provider may hold three subscribers.
When a truncated address still singles someone out
Sample data: a small site logs 30 visitors in one week, and truncating the last byte puts them into 12 blocks of the same size. Six blocks contain exactly one visitor, two contain two, and the other four contain 3, 4, 5 and 8.
- Visitors who are alone in their block: 6 of 30 = 20%.
- Visitors in a block of two or fewer: 10 of 30 = 33%.
- Visitors in a block of five or more: 13 of 30 = 43%.
Within this log, one visitor in five is still the only person from their block. Add the browser, language and time of each row and more rows can be told apart. The Article 29 Working Party's Opinion 05/2014 on anonymisation techniques (WP216) names three questions for any technique: can you still single a person out, link two records about the same person, or infer information about them? Zeroing one byte answers "yes" to at least the first for part of this log, so the result is a lower-risk address, not an anonymous one.
Truncation, hashing and anonymisation compared
| Technique | What it does | Why it is not automatically anonymous |
|---|---|---|
| Truncation | Coarsens the address (table above) | Small blocks, plus other fields in the same row, can still single a person out |
| Plain hash of the address | Replaces the address with a fixed-length string | IPv4 has only 2^32 = 4,294,967,296 possible values, so anyone can hash all of them and look yours up; WP216 warns about replaying a hash over a known input range |
| Keyed hash, key kept apart | Output cannot be recomputed without the secret key | Still pseudonymisation (Article 4(5)): the same input always gives the same ID while the key lives, so the ID links a visitor's records |
| Keyed hash with the key or salt deleted on a schedule | Yesterday's IDs cannot be linked to today's | Linkability across days is gone; within a day the ID still singles out a visitor |
| Aggregation (counts only) | Keeps totals, drops rows | Small counts can still reveal individuals; the row-level data is the part that is gone |
WP216 states plainly that pseudonymisation is not a method of anonymisation. It is a useful security measure that reduces how easily a dataset links to an identity.
Common misunderstandings
- "Zeroing the last byte makes it anonymous." It makes it coarser. The sections above show why a coarser address can still point to one person in a small log.
- "A hashed IP is anonymous." A plain hash of an IPv4 address can be reversed by trying every address. A keyed hash is stronger but still a stable pseudonym while the key is kept.
- "A changing address is not personal data." Breyer concerned dynamic addresses specifically, and found them personal data for an operator with a legal route to the provider's records.
- "If we do not store the IP, nothing is personal." The address is only one input. A visitor ID derived from it, a user ID or a device ID can each be personal data.
- "Truncation ruins location data." It blurs the city and region. Whether the country stays accurate depends on the tool; TapCub reads the country from the full address before truncating.
- "A regulator's condition is a legal definition." France's CNIL lists truncating the last byte of the IP address among the conditions for its consent exemption for audience measurement. That is one condition in a list, not a ruling that truncated addresses are anonymous.
IP addresses in TapCub
Suppose you run a site with visitors in the EU and the UK and want the address handled as lightly as possible. In TapCub it goes like this:
- The address is never written on the event. The collector reads it to look up the country and city, and to build the visitor ID, then discards it. Rate-limit keys use a truncated or keyed form of the address, not the address itself.
- Truncation is off by default. In Configuration › Privacy center you can zero 1 or 2 bytes of IPv4 and keep a /64, /56 or /48 prefix of IPv6, for the whole project or per region. Truncation changes only the address used for the city lookup. Country is always taken from the full address.
- Let the center suggest it. When the last 30 days include EU or UK visitors, the privacy center suggests turning truncation on for those regions only, and leaves other regions unchanged.
- Know what it does not change. The visitor ID is a keyed hash of the address, the browser and a site salt. Truncation does not alter it, and the ID stays a pseudonym. In the default balanced mode the salt is kept per site, so returning visitors can be recognised across days. In strict mode the salt is replaced daily, so yesterday's ID cannot be linked to today's.
- Use the preset if you follow the CNIL exemption. The CNIL preset forces at least 2 bytes for IPv4 and a /64 prefix for IPv6, and region rules cannot loosen it.
You can watch each step with the IP anonymization demo, which runs the same steps in your browser. For retention and the other privacy settings, see how IP truncation and retention work. TapCub does not tell you whether truncated data counts as personal data for your situation; it only changes what is collected, and that judgement stays with you.
Sources
- EUR-Lex, Regulation (EU) 2016/679 (GDPR): Article 4(1) and 4(5), Recitals 26 and 30.
- Court of Justice of the European Union, Breyer, Case C-582/14, judgment of 19 October 2016.
- Article 29 Data Protection Working Party, Opinion 05/2014 on Anonymisation Techniques (WP216).
- Google Analytics Help, IP masking in Universal Analytics (legacy).
- CNIL, Sheet n°16: Use analytics on your websites and applications.
Was this explanation clear?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.

Data Engineer
Writes about event design, data quality, and collection workflows, with verifiable implementation methods for reliable analytics.