Writing · Research Data

How to de-identify research data before you share it

← All writing

Most people de-identify a dataset by deleting the name column and the email column, then calling it done. That works right up until someone notices there's only one 67-year-old female associate dean in the file, and she's from a campus with 900 students.

De-identification is a process, not a single step. This guide walks through it: what counts as an identifier, which rules might apply to you, a pass you can run on almost any tabular dataset, how to check whether it worked, and what to do when it can't work well enough.

Direct and indirect identifiers

It helps to sort every variable into one of three groups before you touch anything.

Removing the first group is the easy part. The real work is the second group, because every indirect identifier you keep makes the next one more dangerous. A well-known study by Latanya Sweeney found that ZIP code, birth date, and sex together were enough to single out a large majority of Americans.

Which rules apply?

"De-identified" means different things under different rules, and it's worth knowing which ones cover your data before you start.

Even when no law applies, your consent form does. If you told people their answers would be "kept confidential and reported only in aggregate," sharing row-level data may break that promise no matter how well you scrub it. The data ethics guide covers consent in more detail, and the consent language guide shows how to word the form so sharing stays possible.

A de-identification pass, step by step

This works for most survey, administrative, and program data. Do it in code, not by hand in a spreadsheet, so you can rerun it and show exactly what changed.

  1. Keep the original untouched. Work on a copy, and store the original somewhere access-controlled. You'll need it if a reviewer asks a question or you find a mistake.
  2. List every variable and classify it as direct, indirect, or analytic. Your codebook is the natural place to do this; add a column for it.
  3. Remove direct identifiers. If you need to link records across files, replace the real ID with a new random study ID and keep the crosswalk (real ID to study ID) separate and private. Don't use a plain hash of the real ID; short IDs like student numbers can be reversed by trying every possibility.
  4. Coarsen dates. Birth date becomes age or birth year. Event dates become the year, the term, or days since a reference point for each person.
  5. Coarsen geography. Street address becomes county, state, or region. For multi-site studies, consider replacing site names with codes, and ask whether the site itself is identifying.
  6. Group rare categories. Collapse small job titles into broader ones, combine small racial and ethnic categories where your analysis allows, and top-code extreme values (every salary above a threshold becomes "above threshold").
  7. Deal with free text. Open-ended answers are where people write "as the only Arabic-speaking librarian in the building..." Review them line by line, redact or generalize, or leave them out of the shared file.
  8. Check the result (next section), then document every change in a short de-identification log that goes with the data.

Every step here trades detail for privacy. Coarsen only as far as you need to; turning every age into "adult" protects people but also makes the data useless. The goal is the least change that gets the risk down to an acceptable level.

How to check whether it worked

The simplest test is to count. Take the indirect identifiers you kept, group the records by every combination of them, and look for small groups.

In R, a grouped count on the quasi-identifiers (count(age_group, gender, dept) with dplyr) shows the small cells in seconds. The sdcMicro package goes further, with risk measures and tools to fix what it finds. In Stata, contract or duplicates report on those variables does the same job. For health data under Expert Determination, this is where you bring in a statistician.

When de-identification isn't enough

Some data can't be de-identified without losing what makes them worth sharing: detailed interview transcripts, longitudinal records that follow the same students for years, data from very small populations, geocoded data, and anything with rich free text. For these, the better answer is controlled access rather than more scrubbing.

Plan this early. The data management plan is where you tell the funder how sensitive data will be shared, and the consent form is where you get permission. Fixing either after collection is much harder.

A note on AI tools

Pasting an identified dataset or transcripts into a public chatbot to "help remove the names" discloses the data to a third party before it's de-identified. If you want AI help with redaction, use a tool your institution has approved for sensitive data, or a model that runs locally. The private AI guide explains what that setup looks like.

If you support researchers

De-identification questions usually arrive at the worst time: the week before a journal wants the data, or right after a funder asks where it's deposited. A short checklist, a worked example in R or Stata, and a named person to ask can save a lot of those weeks. If your campus is building that kind of support, the guide to starting research data services is a place to begin, and I help institutions set it up. Get in touch if that would help.

Common questions

Is removing names enough to de-identify a dataset? No. Indirect identifiers such as dates, small geographic areas, job titles, and rare characteristics can identify people in combination. You need to remove direct identifiers and then reduce or coarsen the indirect ones until no small group stands out.

What is the difference between de-identified and anonymous data? Anonymous usually means the data were never linked to identities, for example a survey that never collected names or emails. De-identified means identifiers existed and were removed or altered. Many regulations treat de-identified data as lower risk, but not zero risk.

Does HIPAA apply to my research data? Only if the data came from, or are held by, a HIPAA covered entity or its business associate, such as a hospital or health plan. Most education and social science data fall under the Common Rule, FERPA, or your consent forms instead. Ask your IRB if you are unsure.

Can I share qualitative interview data? Often, with care. Transcripts need names, places, employers, and distinctive stories edited or generalized, and some data are only suitable for restricted access. Consent forms need to allow sharing in the first place.


Samah Alshrief, Ph.D.

AI data scientist and research-computing specialist. I help researchers and universities with research data management, data services, and private AI. Get in touch →