Database Password Generator
Only characters that survive a connection string without encoding.
Local alternative
openssl rand -base64 32 | tr -d '+/=' | head -c 32Prefer generating secrets on the machine that uses them? This command produces an equivalent value.
Characters such as @, colon, slash, question mark or hash separate the parts of a connection URL like postgres://user:password@host/database. A password containing them has to be percent-encoded, and forgetting that makes the connection fail with misleading errors. This generator uses only the unreserved characters from RFC 3986.
Frequently asked questions
What makes this password connection-safe?
It uses only the unreserved characters from RFC 3986: letters, digits, hyphen, period, underscore and tilde. That lets it survive a connection string such as postgres://user:PASSWORD@host/db without percent-encoding.
Which characters otherwise break a connection string?
Mainly @, :, /, ?, # and square brackets — they are delimiters in a URL and end the password field in the wrong place. Failures of this kind often surface only in a different environment.
Isn't a smaller character set less secure?
Per character, yes, but the length makes up for it: 32 characters from this set give around 190 bits of entropy. That is far beyond anything practically attackable on a database password.