Blog
SHA-256 is the easy part. The normalisation that has to happen first is where match rates are made or broken.
Meta accepts SHA-256 hashed email addresses as a matching key for the Conversions API. The hashing function is one line of code. The normalisation step that has to come before the hash is twelve lines of code, and it is what determines whether your match rate sits at 40 percent or 75 percent.
jane+promo@gmail.com stays as written.const sha256 = require('sha256');
const email = data.email.trim().toLowerCase();
return sha256(email, {outputEncoding: 'hex'});
That is the entire transformation. If your client-side code is sending the email already lowercased, the trim and lowercase steps are defensive. Keep them anyway. Half the time the form on the page does not lowercase, and that half is where the match rate suffers.
For phone numbers, the E.164 normalisation rules are similar but more involved. Get email right first; the lift is bigger and the work is smaller.