Build the same folder twice and you get two different tar files, even when no byte of content changed. That is annoying when you compare checksums or want a cache to hit. Four options in GNU tar remove the noise.
tar --sort=name --mtime=2026-01-01T00:00:00Z \
--owner=0 --group=0 --numeric-owner \
-cf out.tar src
The help text describes --sort=ORDER as the directory sorting order, with name as one choice and none as the default. --mtime sets the modification time of the added files, and --owner and --group fix the owner and group stored for them.
Without the options, one folder touched between two runs gave two different archives:
d041d759a479a55d one.tar
5043abe1e2ddc50f two.tar
These are the first 16 characters of sha256sum. With the options, and a touch in between, both archives were identical:
53f54f2a28c485b6 r1.tar
53f54f2a28c485b6 r2.tar
The listing showed owner 0/0 and the date 2026-01-01 00:00 on every entry.
You can also use -z. With the same options, two -czf runs a few seconds apart gave identical checksums. When you compress through a pipe, gzip -n is the matching switch: its help says it does not save the original name and timestamp.
Caveat: the archive no longer tells you who owned a file or when it was changed. That is the point for a release tarball, and wrong for a backup you plan to restore with the original dates. For backups, leave these options out.
Further reading: GNU tar manual, Reproducible Builds: archives