How to hash email addresses in Excel
And why a plain hash is not enough
Hashing turns a value into a fixed-length code: the same email always gives the same code, so you can still count, join and deduplicate, but the code doesn't show the email. It is a good way to pseudonymize identifiers, if it is done with a key.
Hashing in Excel
Excel has no worksheet function for SHA-256 or any other cryptographic hash. People use VBA
macros, very long LAMBDA formulas, or a tool. Whatever you use, normalise first: trim spaces
and lower-case emails, or Matti@Example.com and
matti@example.com get different codes.
Why a plain hash can be reversed
A hash can't be run backwards, but it can be guessed. The EU data protection authorities' opinion on anonymisation techniques (WP216, section 4) explains that if the range of possible inputs is known, each candidate can be hashed and compared. Email addresses, phone numbers and national IDs are exactly that kind of input: anyone with a customer list or a phone number range can rebuild the table. Adding a salt helps only a little, because the salt is usually not secret.
The opinion's stronger option is a keyed hash: a hash that also takes a secret key. Without the key, guessing is impractical; with it, you can still reproduce the same codes next month. Keep the key away from the hashed data.
Hashed data is still personal data
Whoever holds the key, or the original list, can link the codes back to people, so a hashed dataset is pseudonymized, not anonymous, and the GDPR still applies to it. See anonymization vs pseudonymization.
Keyed hashing with Scrubsheet
Choose Hash for a column. Scrubsheet uses HMAC-SHA-256, a keyed hash. Without a project secret, each run uses a random key that is thrown away, so the codes can't be reproduced, even by you. With consistent output and your own project secret, the same value gets the same code in every file. Codes are 16 hexadecimal characters by default, and up to the full 64.
This guide explains the rules as we understand them; it is not legal advice. Whether a particular dataset is anonymous depends on its content and on who receives it.
Try it on your own file. The Scrubsheet browser tool anonymizes Excel and CSV files in your browser, free and without uploading anything. In Excel, use the Scrubsheet add-in.
Anonymize a spreadsheet