Open-Source PostgreSQL Data Masking Tools Compared (2026): Greenmask vs PostgreSQL Anonymizer vs pganonymize vs Cloud-DB-Anonymizer

If you need production-like PostgreSQL data without real personal data, there are several good open-source options. They differ less in what they mask than in where they run and what they touch: some live inside the database server, some rewrite data in place, and some only read and write a new dump. This comparison covers the four tools most teams evaluate, based on each project's own documentation.

Disclosure: Cloud-DB-Anonymizer is our tool. We have tried to describe every project fairly; corrections are welcome.

The short version

Greenmask PostgreSQL Anonymizer pganonymize Cloud-DB-Anonymizer
Type Standalone dump/restore tool (single binary) PostgreSQL extension Python CLI Python CLI
Language Go Runs inside PostgreSQL Python Python 3.10+
License Apache-2.0 PostgreSQL License MIT MIT
Where rules live Config file In the database (declared alongside table definitions) YAML file rules.json file
Changes the source database? No (dump-based) Static masking: yes. Dynamic masking and anonymous dumps: no Yes, anonymizes in place (dry-run available) No, reads a read-only snapshot
Deterministic masking Yes (hash-based) Via functions you choose Partly (e.g. md5 provider) Yes, every strategy (HMAC-SHA256 + salt)
Output Logical backup restorable with pg_restore; local or S3-compatible storage Masked database, masked views for some roles, or SQL dump Anonymized database; optional dump via pg_dump Gzip SQL file restorable with psql; optional S3-compatible upload
Subsetting Yes, referentially intact (incl. cyclic references) Not its focus WHERE / regex exclusions, table truncation Per-table WHERE filters and schema-only tables
Other databases MySQL in beta PostgreSQL only PostgreSQL only PostgreSQL only

Greenmask

Greenmask is a Go tool that positions itself as a replacement for pg_dump/pg_restore with anonymization built in. It uses hash-based deterministic transformers, supports conditional and inherited transformations, writes to local disk or S3-compatible storage, and can produce referentially intact subsets of a database, including cyclic and polymorphic references. It ships as a single binary and supports custom transformers in any language.

Choose it if you want the most feature-complete dump-based tool, need subsetting of large databases, or already run Go binaries in your pipeline.

PostgreSQL Anonymizer

PostgreSQL Anonymizer by Dalibo is a server extension. Masking rules are declared inside the database, next to your table definitions, and the extension offers static masking (permanently rewrites data), dynamic masking (only masked users see fake values) and anonymous dumps. It has a wide set of functions: randomization, faking, partial scrambling, shuffling, noise and custom functions. Installation means adding the package for your PostgreSQL version and loading anon through shared_preload_libraries, so check whether your managed provider allows that extension.

Choose it if you control the PostgreSQL server, want rules versioned with your schema, or need dynamic masking for analysts querying live data.

pganonymize

pganonymize is a long-standing Python CLI. You describe tables and columns in a YAML file and pick providers such as faker, mask, partial_mask, md5, set or clear. It anonymizes the target database directly (there is a --dry-run option), and can write a dump afterwards with --dump-file. Run it against a copy, never against production.

Choose it if you already restore production into a scratch database and want a simple Python tool to scrub that copy.

Cloud-DB-Anonymizer

Cloud-DB-Anonymizer is a newer MIT-licensed Python CLI focused on one workflow: produce a sanitized, restorable SQL file from a live database without ever writing to it. It opens one REPEATABLE READ, READ ONLY transaction, exports the schema with pg_dump, streams rows through 20 deterministic strategies (email, name, phone, Luhn-valid credit card, IBAN, SSN, address, IP, date of birth, hash, redact, null and more), writes data in foreign-key order and resets sequences.

export ANON_SALT=$(openssl rand -hex 32)
python main.py sanitize --db-url "$DATABASE_URL" --rules rules.json --dry-run
python main.py sanitize --db-url "$DATABASE_URL" --rules rules.json --upload my-backups

Because every value is derived from HMAC-SHA256 with your salt, the same email becomes the same fake email in every table and on every run, so joins and unique constraints survive. It does not do referential subsetting like Greenmask or dynamic masking like PostgreSQL Anonymizer.

Choose it if you want a small Python tool that works with a read-only user on any managed PostgreSQL (RDS, Cloud SQL, Supabase, Neon), with no server extension and no in-place changes. For scheduled multi-cloud backups, a dashboard and alerts, there is a paid self-hosted Pro Suite.

What about Neosync?

Neosync was a popular open-source option for anonymization and synthetic data. Its company was acquired by Grow Therapy in 2025, and directories such as AlternativeTo now list its GitHub repository as archived. Check the project's current status before adopting it for new work.

How to decide

  • You cannot install extensions (most managed databases): use a dump-based tool such as Greenmask or Cloud-DB-Anonymizer.
  • You need a smaller database, not just a masked one: Greenmask's subsetting is the strongest here.
  • Analysts query production and must not see PII: PostgreSQL Anonymizer's dynamic masking is built for that.
  • You already maintain a scratch copy: pganonymize can scrub it in place.
  • You want the simplest read-only path from production to a restorable file: Cloud-DB-Anonymizer.

Whichever you pick, keep rules in version control, review them with every migration, and use a read-only database user. For a full walkthrough, see how to anonymize a PostgreSQL database for staging, or visit the project page.

Sources