Skip to content

How to Encrypt Sensitive Gravity Forms Fields (SSN, Date of Birth) With Field Privacy

Encrypt Social Security numbers, dates of birth and other sensitive Gravity Forms fields in the database, send masked emails, block duplicates and redact the full values after review with the Gravity Labs Field Privacy Add-On.

Chris Eggleston 10 min read

Gravity Forms stores every answer as plain text in your database. That is fine for a name or a message. It is not fine for a Social Security number, a date of birth or a driver’s license number sitting in every backup, every staging copy and every database export you hand to a developer. The Gravity Forms Field Privacy Add-On from Gravity Labs encrypts the fields you choose before they are saved, shows the full value only to logged-in reviewers, sends masks like ***-**-6789 in emails, and can wipe the full value for good once you are done with it.

Tested November 2026 with version 0.1.0-alpha.1 on a test site, with Gravity Forms 3.2.1 and Gravity Flow 3.1.2. In this tutorial we build a rental application that collects an SSN for a background check, let a landlord review it, then redact it automatically. The form is free to download at the bottom of the post.

What We’re Building

  • A Rental Application form where the SSN, date of birth, phone, driver’s license, income and address are encrypted in the database.
  • A landlord notification and an applicant receipt that show masks, never the full numbers.
  • A Gravity Flow review step where the landlord sees the full values, followed by a step that redacts them permanently.
  • No Duplicates on the SSN, so the same person can’t apply twice, even though the stored value is encrypted.

What You Need

  • Gravity Forms 2.9.24 or newer (any license; Labs add-ons are free for license holders).
  • The Field Privacy Add-On from Gravity Labs.
  • PHP with the sodium extension (standard since PHP 7.2; your host almost certainly has it).
  • Access to wp-config.php, to add the encryption key.
  • Optional: Gravity Flow for the review-then-redact workflow. Without it you can still redact after any add-on feed.

Step 1: Create and Save Your Encryption Key

After activating the add-on, go to Forms → Settings → Field Privacy. Until a key exists, the page shows a red warning and a Generate encryption key button. Click it and you get one line of PHP to paste into wp-config.php, above the /* That's all, stop editing! */ comment.

Field Privacy settings with the Gravity Labs notice, a No encryption key found warning, the Generate encryption key button and a wp-config.php define line with a Copy button
The key is generated in your browser session and never stored by the add-on. This one is from my test site; never reuse a key from a screenshot.

Reload the settings page and the warning turns green: Encryption key is defined. If you prefer the command line, this does the same thing:

php -r "echo base64_encode(random_bytes(32)), PHP_EOL;"

Back the key up somewhere outside the site (a password manager is ideal). Encrypted values can only be read with this exact key. Lose it, or change it, and every entry that hasn’t been redacted yet is unreadable. There is no key rotation in this version.

Step 2: Build the Form and Mark the Sensitive Fields

Build the form as usual. My rental application has Full Name, Email, Phone, Date of Birth, Social Security Number (a Single Line Text with the 999-99-9999 input mask), Driver’s License Number, Monthly Income, Current Address and a consent checkbox.

For each sensitive field, open Field Settings → Advanced, tick Encrypt at rest, and choose how it should look in Emails and PDFs:

Form editor with the Social Security Number field selected; the Advanced tab shows Encrypt at rest checked and Emails and PDFs set to Masked, and each encrypted field on the canvas has an Encrypted label
Encrypt at rest and the Emails and PDFs mask live in the Advanced tab of each field.
FieldEmails and PDFsWhat the landlord’s email shows
Social Security NumberMasked***-**-6789
Date of BirthMasked**/**/****
PhoneMasked(***) ***-0142
Driver’s License NumberHidden[redacted]
Current AddressMaskedStreet hidden, city and state kept, last two ZIP digits
Monthly IncomeFull value5,400 (still encrypted in the database)

Leave Name and Email unencrypted. You will want to search entries by name, Gravity Forms needs the email to send the applicant a receipt, and neither is the kind of data that causes real harm on its own. Encrypted fields cannot be searched, sorted or used for routing.

Once any field is encrypted, the form editor shows a reminder at the top and an Encrypted label next to each protected field, so nobody on your team forgets this form is special:

Form editor notice saying 6 fields are encrypted, with an Encrypted label next to Phone, Date of Birth, Social Security Number, Driver's License Number, Monthly Income and Current Address
The notice counts the encrypted fields, and each one is labeled on the canvas.

Pricing fields (Product, Option, Quantity, Shipping, Total), File Upload, Credit Card, Password and the layout fields don’t offer the setting. Payment add-ons and order summaries read those values directly, so encrypting them would break checkout.

Step 3: Submit a Test Entry

Nothing changes for the person filling out the form. They type their details and submit:

The Rental Application form filled in with a name, email, phone, date of birth, Social Security number, license number, income and address
The applicant sees a normal form.

Behind the scenes, each marked value is encrypted with libsodium (XSalsa20-Poly1305) before Gravity Forms writes it. In the database, the SSN row now reads something like gffp:v1:xtF/Zx6XM4ow+tDrKJFg… instead of 123-45-6789. Logged in, the entry looks exactly as it always did, because the add-on decrypts on the way out:

Gravity Forms entry detail showing the full phone, date of birth, Social Security number, license number, income and address, each with an Encrypted label
Reviewers see full values on the entry detail screen and in the Gravity Flow inbox. The Encrypted label shows which fields are protected.

Save and Continue drafts are encrypted the same way, including multi-input fields like the address.

Step 4: Send Notifications That Only Show Masks

Email is the leakiest part of most form setups: notifications sit in inboxes forever and get forwarded. The add-on applies each field’s mask to merge tags, so {all_fields} and individual tags like {Social Security Number:5} both come out masked. You don’t change your notifications at all.

The landlord notification email showing a masked phone, starred date of birth, SSN ending 6789, license redacted and an address with the street hidden
The landlord’s notification, built with {all_fields}. Enough to recognize the applicant, not enough to steal their identity.

Masks apply everywhere merge tags are used, including the confirmation message (mine says “We received your application ending in SSN ***-**-6789”). The add-on says PDFs built from merge tags get the mask too; I didn’t have a PDF add-on on the test site to confirm it. If someone genuinely needs the full value, they read it on the entry while logged in.

Step 5: Block Duplicate Applications

Turn on No Duplicates in the SSN field’s General settings as you normally would. Because every encryption uses a random nonce, the same SSN never produces the same ciphertext twice, so Gravity Forms can’t compare stored values. The add-on stores a keyed fingerprint (HMAC) of each value and answers Gravity Forms’ duplicate check from it:

Social Security Number field with the validation message This value has already been used
A second application with the same SSN is refused. The message does not repeat the number back.

Gravity Forms’ default message echoes the value (“‘123-45-6789’ has already been used”), which tells anyone typing numbers that a record exists. For encrypted fields the add-on replaces it with a neutral “This value has already been used.” The fingerprint is deleted when an entry is redacted, so duplicates are checked against applications that are still under review.

Step 6: Redact the Full Values When You’re Done

Encryption protects a stolen database, but anyone who gets wp-config.php too can still decrypt. The real win is not keeping the data once the decision is made. Redaction replaces the stored value with its mask permanently: 123-45-6789 becomes ***-**-6789 in the database, and Hidden fields become empty. There are three ways to trigger it.

Option A: A Redact Step in Gravity Flow

Add an Approval step assigned to whoever reviews applications (“Landlord Review”), then a new step and pick the Redact privacy fields step type. It has no settings: when the workflow reaches it, the values are masked and the workflow moves on.

Gravity Flow step settings with the Redact privacy fields step type selected and its description
The Redact privacy fields step type, added to Gravity Flow by the add-on.

Put it after anything that needs the real number, like a step that sends the SSN to a screening service.

Option B: Redact After Any Workflow Step

Every Gravity Flow step also gets a Redact privacy fields after this step is processed checkbox, just above Next Step. Tick it on the Approval step and you don’t need a separate step. Note that it runs however the step ends, so a rejected application is redacted too (which is usually what you want).

Approval step settings with a Field Privacy checkbox: Redact privacy fields after this step is processed
The checkbox on an Approval step.

Option C: Redact After a Feed Succeeds

No Gravity Flow? Any feed add-on gets a Field Privacy section. With Redact privacy fields after this feed succeeds ticked, the values are masked only once that feed reports success. In testing, a Webhooks feed that failed (SSL error) left the values alone, and the same feed succeeding redacted them.

Webhooks feed settings with a Field Privacy section and Redact privacy fields after this feed succeeds checked
Send the full value to one service, then keep only the mask.

What a Redacted Entry Looks Like

After the landlord approved Jordan’s application, the redact step ran:

The entry after redaction: Redacted labels on the masked phone, starred date, SSN ending 6789 and address; Monthly Income still marked Encrypted; no license number
The labels switch to Redacted. The license number is gone and the rest are masks. Monthly Income is set to Full value, so it stays encrypted rather than being redacted.

An entry note records when and why, which is what you’ll want if anyone ever asks:

Entry notes: Landlord Review approved, then Privacy fields redacted by the workflow step Redact Sensitive Fields
The note names the step or feed that triggered the redaction.

Redaction can’t be undone, and redacted masks are stored as plain text, so they no longer depend on the key. Fields set to Full value are skipped: writing the full value back unencrypted would be less private than leaving it alone.

Things to Know

  • It is a Gravity Labs project. Not covered by Gravity Forms support. Questions go to the Labs category on the community forum, the feedback form on the Labs page, or GitHub.
  • Never deactivate it after collecting entries. Encrypted values stay encrypted; without the add-on and the key, reviewers see gffp:v1:… instead of the value.
  • Logged-in access is still full access. Anyone who can view entries sees decrypted values, and CSV exports and the REST API return them decrypted too. Limit who can view and export entries (the Members plugin or Gravity Forms’ role capabilities).
  • Encrypted fields can’t be searched, sorted or filtered. Keep the fields you search by (name, email) unencrypted.
  • Turning encryption on later doesn’t touch old entries. Entries saved before you ticked the box stay plain text. Duplicates are only matched against entries saved after the fingerprint was introduced.
  • Not covered: File Upload contents, PDFs already written to disk (Gravity PDF saves them as files), and pricing fields.
  • This is not a GDPR request tool. For export and erasure requests use Gravity Forms’ Personal Data settings. Field Privacy is about storing less, for less time.

Alternatives

Gravity Forms core has no field encryption. The built-in Personal Data settings can skip saving IP addresses, auto-delete entries after a number of days, and handle WordPress export/erase requests, but they work on whole entries, not single fields, and keep everything in plain text until then. If you never need the value after submission, the simplest option is still not to ask for it. For hiding fields from colleagues rather than attackers, see Hide Fields From the Gravity Forms Entry Details Page. Field Privacy fills the gap in between: keep the entry, review the value, then shrink it to a mask.

Who Should Use It

Anyone collecting identity numbers through Gravity Forms: rental and loan applications, employee onboarding (SSN, bank details for payroll), patient intake (dates of birth, member IDs), scholarship and background-check forms. Agencies will like it for client sites where the database gets copied to staging and local environments: those copies now hold ciphertext. It does not make WordPress compliant with HIPAA or PCI on its own, and card numbers should still go through a payment gateway, never a form field.

Download the Form Template

Get the Rental Application from this tutorial with the Field Privacy settings already on each field, No Duplicates on the SSN, and masked notifications, plus a README with the two Gravity Flow steps to add.

This field is for validation purposes and should be left unchanged.
Name*(Required)

Frequently Asked Questions

Can Gravity Forms encrypt field data?

Not on its own. Gravity Forms saves entries as plain text. The Field Privacy Add-On from Gravity Labs encrypts the fields you mark with libsodium before they are saved, using a key you add to wp-config.php, and decrypts them for logged-in reviewers.

How do I hide a Social Security number in Gravity Forms notification emails?

Mark the field Encrypt at rest and set Emails and PDFs to Masked. Notifications, {all_fields} and individual merge tags then show ***-**-6789 instead of the full number. Set it to Hidden to show [redacted] instead.

Can admins still see the full value?

Yes. Logged-in users who can view entries see the full decrypted value on the entry detail screen and in the Gravity Flow inbox until the entry is redacted. Exports and the REST API also return decrypted values, so limit who has those capabilities.

What happens if I lose the encryption key?

Values encrypted with it cannot be recovered. Back the key up outside the site. Changing the key has the same effect for existing entries, because this version does not re-encrypt them.

Does No Duplicates work on encrypted fields?

With Field Privacy it does, for single-input fields. The add-on stores a keyed fingerprint of each value and uses it for Gravity Forms’ duplicate check. The fingerprint is deleted when the entry is redacted.

Can I search entries by an encrypted field?

No. Encrypted values cannot be searched, sorted or filtered in the entry list. Keep fields you search or route by, such as name and email, unencrypted.

Is the Field Privacy Add-On free?

It is a Gravity Labs download, free for anyone with an active Gravity Forms license. Labs projects are experimental and not covered by Gravity Forms support.

Need More Help?

If you still need help, use the chat or leave a comment below and we’ll get back to you.

Comments

Ask a question or leave a comment

Your email is never shown. For help with a specific form, share what you expected and what happened instead.