How to normalize and hash customer data for Google Ads

Google Ads enhanced conversions require normalizing customer data before applying one-way SHA-256 hashing encoded in hexadecimal (or Base64 in the Data Manager API). Trim whitespace and lowercase emails, strip dots and plus-suffixes from gmail.com and googlemail.com usernames, format phone numbers in strict E.164 (+18005550100), hash names and street lines, and leave country and postal codes unhashed.

Key facts

  • For gmail.com and googlemail.com addresses, you must remove all periods and any plus-suffix before the @ symbol prior to SHA-256 hashing, while keeping dots and plus signs on all other domains. Source: developers.google.com
  • Phone numbers must follow strict E.164 format—a leading plus sign, country code, and digits only with no spaces or dashes, such as +18005550100—before SHA-256 hashing. Source: developers.google.com
  • In Data Manager API UserData, region_code and postal_code must never be hashed, while given_name, family_name, email_address, and phone_number must be normalized and SHA-256 hashed. Source: developers.google.com
  • Each Google Ads API ClickConversion accepts up to five UserIdentifier objects, while each Data Manager API Event accepts up to ten UserIdentifier objects, with one identifier type per object. Source: developers.google.com
  • Google Ads Help states email addresses must not contain accents, consecutive dots, spaces, or leading/trailing periods, whereas First Name and Last Name may retain accents. Source: support.google.com
A spreadsheet printout of normalized customer fields beside a pen and desk phone on dark wood.
On this page

Why do exact normalization rules decide your enhanced conversions match rate?

SHA-256 is deterministic and unforgiving: a single stray space, an uppercase letter, a missed dot in a Gmail address, or a missing +1 country code produces a completely different 64-character hash that Google Ads cannot match. Before hashing any customer record for enhanced conversions for leads, you must normalize every field to Google’s exact canonical string—or validate your file locally in our enhanced conversions upload validator. For the broader workflow, see our Google Ads offline conversions pillar guide.

Both the Data Manager API formatting guide and the Google Ads API offline conversion documentation publish the exact rules for emails, phone numbers, and mailing addresses. Every detail below is drawn directly from those specifications (checked Nov 2026).

How do you normalize and hash email addresses?

Apply two stages to every email address before encoding it as UTF-8 bytes and running SHA-256: standard normalization for all domains, plus Gmail-specific normalization when the domain is gmail.com or googlemail.com.

  1. Trim whitespace and lowercase (all domains): Strip leading, trailing, and intermediate ASCII whitespace, then convert every character to lowercase.
  2. Check for valid structure: Confirm the address contains @, a period followed by a top-level domain (such as .com), no consecutive dots (..), no leading or trailing periods, and no accented characters in the email string, per Google Ads Help 13321563.
  3. Strip dots and + suffixes for Gmail and Googlemail only: Split on @. If the domain equals gmail.com or googlemail.com, remove every . character in the username (before @), and remove the first + sign plus everything after it up to @.
  4. Leave non-Gmail usernames untouched: For corporate domains, Yahoo, Outlook, iCloud, and every other domain, keep periods and plus tags intact.
  5. Hash with SHA-256: Encode the normalized UTF-8 string with SHA-256 and output a 64-character lowercase hexadecimal string (Data Manager API also accepts Base64 encoding when specified in the request’s encoding field, whereas hex is case-insensitive).

Google’s developer docs emphasize a subtle trap: unlike Customer Match, where Google handles some Gmail variations internally, enhanced conversions requires your pipeline to remove dots and plus-suffixes before hashing. Failing to do so silently drops Gmail matches.

Raw email Normalized string before SHA-256 Why
Jane.Doe+Shopping@googlemail.com janedoe@googlemail.com Trimmed, lowercased, dots and +shopping stripped for googlemail.com
Alex.2+myalias@GMAIL.com alex2@gmail.com Trimmed, lowercased, dot and +myalias stripped for gmail.com
user.name+NYC@Example.com user.name+nyc@example.com Non-Gmail domain keeps . and +nyc; only lowercased and trimmed

How do you format phone numbers into E.164 before hashing?

Every phone number sent to Google Ads enhanced conversions must follow strict E.164 format prior to SHA-256 hashing: a leading + sign, the numeric country code, and the subscriber digits with zero spaces, parentheses, dashes, or extensions.

Using Google’s reference rule from the Data Manager API formatting specification:

  1. Trim whitespace and punctuation: Remove spaces, (, ), -, ., and extension suffixes (ext, x102)—never hash an extension inside the phone field.
  2. Ensure the country code is present: Many US Shopify and CRM exports store 10-digit numbers (8005550100). If the leading country code is missing, prepend the customer’s country dialing code (such as 1 for US/Canada) before adding +, and strip any leading domestic trunk zero where applicable (for example, UK 020 becomes +4420).
  3. Validate length and prefix: Confirm the string starts with + followed by the country code and digits only (up to 15 total digits under E.164), then UTF-8 encode and SHA-256 hash.
Raw phone input (assumed US) Normalized E.164 before SHA-256 Valid?
(800) 555-0100 +18005550100 Yes, after prepending +1 and stripping punctuation
+1 (800) 555-0199 +18005550199 Yes, punctuation and spaces stripped
001-800-555-0100 +18005550100 Replace 00 international prefix with +
555-0100 (7 digits, no area code) Reject Missing area code and country code

Which address and name fields are hashed vs unhashed?

Mailing address matching behaves differently across Google’s APIs and requires careful separation between hashed and plain-text subfields. First, check endpoint support: in the legacy Google Ads API’s UploadClickConversions, address_info is not supported on offline click conversions—only hashed_email and hashed_phone_number work there. In the Data Manager API (IngestEvents) and ConversionAdjustmentUploadService, AddressInfo is supported.

When supplying address inside a Data Manager API UserIdentifier, Google enforces these exact rules:

Field Hash with SHA-256? Normalization rule Scope note
given_name (First name) Yes Trim whitespace, lowercase, remove prefixes (Mrs., Mr.); accents allowed Required in AddressInfo
family_name (Last name) Yes Trim whitespace, lowercase, remove suffixes (Jr., III); accents allowed Required in AddressInfo
region_code (Country) No (plain text) 2-letter ISO 3166-1 alpha-2 code (e.g., US), trimmed Required in AddressInfo
postal_code (ZIP/Postal) No (plain text) Trim whitespace; 5 digits or 5+4 for US (94045); no extensions outside US Required in AddressInfo
address_line Yes Trim, lowercase, remove symbol characters Google Analytics only
city, administrative_area No (plain text) Trim, lowercase, remove symbol characters (ca or california) Google Analytics only

Crucially, if you populate userIdentifiers.address in the Data Manager API, Google requires all four of givenName, familyName, regionCode, and postalCode. Sending partial address fragments triggers validation errors.

How should you structure UserIdentifier lists and CSV uploads?

Formatting each string correctly is only half the job—packaging those hashes cleanly into API payloads or Data Manager files prevents silent drops and fast-fail rejections:

  • One identifier per UserIdentifier object: In both Google Ads API and Data Manager API schemas, UserIdentifier uses a oneof structure. Assigning both emailAddress and phoneNumber onto the same UserIdentifier item clears the first field. Always append separate UserIdentifier entries to userIdentifiers[].
  • Respect per-event identifier caps: Send up to 5 UserIdentifier objects per conversion in the Google Ads API, or up to 10 UserIdentifier objects per Event in the Data Manager API. Including multiple emails or phone numbers from the same customer record increases match probability.
  • Pre-hash for scheduled imports: In Google Ads UI CSV/Google Sheets uploads, one-time manual uploads can optionally let Google hash plain-text columns, but scheduled automatic imports with enhanced conversions for leads require pre-hashed SHA-256 values, per Google Ads Help 7014069.
  • Check BRAID interactions: Remember from our gclid, wbraid, gbraid guide that if a row carries wbraid or gbraid without a gclid, Google Ads ignores user_identifiers on that event anyway.
  • Handle encoding consistently: In Data Manager API IngestEventsRequest, explicitly set encoding to HEX or BASE64 matching your hash output, and test every batch with validateOnly: true before live ingestion so one malformed row does not fast-fail an entire batch.

How do Hex vs Base64 encoding and Data Manager encryption differ?

Google’s Data Manager API accepts SHA-256 digests encoded in either hexadecimal (HEX) or Base64 (BASE64), and optionally wrapped in Cloud KMS or AWS KMS payload encryption for confidential matching. Mixing up hex strings and raw binary digests during Base64 encoding is one of the fastest ways to break matching without triggering a schema error.

Understand the exact difference before setting encoding in IngestEventsRequest, per Google’s Data Manager formatting guide and Send events reference:

  • Hexadecimal (HEX): Represents the 32-byte SHA-256 digest as a 64-character string of 0-9 and a-f (for example, john.smith@example.com hashes to 8e621e3d0368631d263d07a351fa8d34fba0d17c15fbcdec11a5f58008d022a0). Google states that hex encoding is case-insensitive, so uppercase or lowercase hex both validate.
  • Base64 (BASE64): Encodes the raw 32-byte binary SHA-256 digest into a 44-character Base64 string, and Google notes explicitly that case sensitivity matters for Base64. Never Base64-encode the 64-character hex string—that hashes and encodes the ASCII text of the hex characters instead of the 32 digest bytes.
  • Optional payload encryption (encryptionInfo): Unlike the legacy Google Ads API, Data Manager supports encrypting already-hashed userData values with a Data Encryption Key (DEK) wrapped by Google Cloud KMS or AWS KMS and Workload Identity Federation, as detailed in the Data Manager encryption guide. Standard SHA-256 hashing does not require KMS unless your compliance team mandates confidential encryption in transit.

What does a spec-accurate normalization and SHA-256 function look like?

A production hashing helper only needs a few lines of code, provided it restricts dot and plus-suffix removal strictly to gmail.com and googlemail.com and preserves dots and plus tags on every other domain. Many generic snippets found online strip + suffixes from all email domains—which diverges from Google’s documented rule for corporate and non-Gmail addresses.

Below is a minimal Python implementation matching Google’s Data Manager formatting specification:

import hashlib
import re

def normalize_email(raw: str) -> str:
    cleaned = re.sub(r"\s+", "", raw or "").lower()
    if "@" not in cleaned:
        return ""
    local, domain = cleaned.rsplit("@", 1)
    if domain in ("gmail.com", "googlemail.com"):
        local = local.split("+", 1)[0].replace(".", "")
    return f"{local}@{domain}"

def normalize_phone_e164(raw: str, default_country_code: str = "1") -> str:
    s = (raw or "").strip()
    s = re.split(r"(?:ext\.?|x)\s*\d+", s, maxsplit=1, flags=re.I)[0]
    has_plus = s.startswith("+")
    digits = re.sub(r"\D", "", s)
    if not digits:
        return ""
    if not has_plus and digits.startswith("00"):
        digits = digits[2:]
        has_plus = True
    if not has_plus and len(digits) == 10 and default_country_code == "1":
        digits = "1" + digits
    return f"+{digits}" if 8 <= len(digits) <= 15 else ""

def sha256_hex(normalized_value: str) -> str:
    return hashlib.sha256(normalized_value.encode("utf-8")).hexdigest()

Notice two defensive safeguards in that snippet: intermediate whitespace inside an email address is removed (re.sub(r"\s+", "", ...)), matching Google’s requirement to trim leading, trailing, and intermediate spaces; and phone extensions such as ext 102 or x45 are stripped before extracting digits so extension digits never pollute the E.164 subscriber number. For international phone numbers outside the US and Canada, use a full country-aware parser such as libphonenumber rather than a fixed 10-digit rule so leading domestic trunk zeros (like UK 020) are stripped accurately.

What common hashing mistakes cause silent zero-match uploads?

Even when an upload passes API schema checks, subtle normalization bugs drop match rates to zero without returning an HTTP error. Checking your pipeline against these six failure modes from Google Ads Help 13321563 and the Data Manager formatting guide catches almost every match loss:

Mistake What goes wrong How to fix it
Double-hashing an already hashed export Running SHA-256 on a 64-character hex string produces a valid-looking hash that matches nothing Detect 64-char hex strings (^[0-9a-fA-F]{64}$) and skip re-hashing
Hashing region_code or postal_code Data Manager expects plain-text ISO country (US) and ZIP (94045) Hash only given_name, family_name, email_address, phone_number, and address_line
Stripping dots or + on corporate emails Alters first.last@company.com into firstlast@company.com Strip . and +suffix only when domain is gmail.com or googlemail.com
Hashing 10-digit US numbers without +1 Produces a different digest than +18005550100 Always convert to strict E.164 with leading + and country code first
Leaving accents or consecutive dots in emails Fails email validation or mismatches canonical strings Reject .., leading/trailing periods, and accented characters in email fields (accents are fine in given_name / family_name)
Packing email and phone in one UserIdentifier Protobuf oneof overwrites the first identifier Create one UserIdentifier object per email, phone, or address (up to 10 per Event in Data Manager)

Where can you test your hashing and CSV formatting before uploading?

Instead of debugging fast-fail Data Manager errors in production, test a sample export locally in your browser with our enhanced conversions upload validator. Nothing leaves your browser: the validator trims and lowercases emails, applies gmail.com and googlemail.com dot and + removal, formats phone numbers to E.164 by country, flags BRAID-plus-PII rows or missing timezone offsets, and outputs a clean SHA-256 hashed CSV ready for step-by-step offline conversion import.

If your store handles phone and draft orders and you want daily normalization, hashing, click-ID capture, and Data Manager API uploads automated end to end, explore our closed-loop build.

Frequently asked questions

Why does Google Ads require stripping dots from Gmail addresses before hashing?

Gmail ignores periods and plus-tag suffixes in the local part of an email address, meaning jane.doe+shop@gmail.com delivers to janedoe@gmail.com. Because SHA-256 produces completely different 64-character hashes for even a one-character change, Google stores canonicalized Gmail hashes. If you hash the dots or plus suffix, your hash will never match Google's account hash—and Google's docs warn that unlike Customer Match, you must normalize Gmail variations yourself for enhanced conversions.

Should I strip dots from non-Gmail email domains like company domains or Yahoo?

No. Both the Google Ads API docs and the Data Manager API formatting guide state explicitly that dot and plus-suffix removal applies only to gmail.com and googlemail.com domains. For any other domain—such as user.name+nyc@example.com—you only trim leading, trailing, and intermediate whitespace and convert all characters to lowercase before running SHA-256.

Do I hash country and zip/postal codes for enhanced conversions?

No. When sending mailing address fields through the Data Manager API or ConversionAdjustmentUploadService, hash only given_name (first name), family_name (last name), and address_line (GA4 only). Leave region_code (2-letter ISO code like US) and postal_code (5 digits or 5+4 for US) in plain text. Also note that Google Ads API UploadClickConversions does not support address_info at all on offline click conversions.

Should phone numbers include a plus sign and country code before SHA-256 hashing?

Yes. Every phone number must be converted to E.164 format before hashing: a leading plus sign (+), followed immediately by the country code and subscriber digits, with all spaces, parentheses, dashes, and extensions stripped (for example, +18005550100). If you hash a 10-digit US number without +1, or hash formatted characters like (800) 555-0100, Google cannot match the hash.

Can I put both hashed email and hashed phone in the same UserIdentifier object?

No. In Google's API protobuf schema, the identifier inside UserIdentifier is a oneof field. If you assign both hashed_email and hashed_phone_number on the same UserIdentifier object, the second field overwrites and clears the first. Instead, create a separate UserIdentifier object for email, another for phone, and another for address, up to five per conversion in Google Ads API or ten in Data Manager API.

Should I encode SHA-256 hashes as Hex or Base64 for the Data Manager API?

Both HEX and BASE64 are supported in Data Manager API as long as the request's encoding field matches your output. Hexadecimal produces a 64-character case-insensitive string and is easiest to inspect and debug. If you choose Base64, you must encode the raw 32-byte binary SHA-256 digest rather than the 64-character hex text, and preserve exact uppercase and lowercase Base64 characters.

Sources

  1. Format user data | Data Manager API | Google for Developers (checked )
  2. Manage offline conversions | Google Ads API | Google for Developers (checked )
  3. Limits and quotas | Data Manager API | Google for Developers (checked )
  4. Fix discrepancies and errors in offline conversion imports | Google Ads Help (checked )
  5. About the customer matching process | Google Ads Help (checked )
  6. Import conversions from ad clicks into Google Ads using files (legacy) | Google Ads Help (checked )
  7. Encrypt user data | Data Manager API | Google for Developers (checked )
  8. Send events | Data Manager API | Google for Developers (checked )