- Tools
- Connection String Builder
Free tool
Connection String Builder
Fill in the fields to build a valid connection string, or paste one to break it into its parts. Works for PostgreSQL, MySQL, MongoDB, Redis, SQL Server, and more. Everything runs in your browser.
postgresql://user:password@localhost:5432/mydb
jdbc:postgresql://localhost:5432/mydb?user=user&password=password
One line that describes a whole connection
Almost every database driver, ORM, and hosting platform accepts a connection string. It packs the database type, host, port, database name, and login into a single value you can drop into an environment variable. Get one character wrong and the connection fails with an error that rarely points at the real problem.
This builder assembles the string for you from labelled fields, so the scheme, port, and encoding are always correct. Paste an existing string into the parse box and it works in reverse, splitting the value into readable parts so you can see exactly which host or database it points at.
The format for each database
Most databases share the same URI shape and differ only in the scheme and default port. PostgreSQL uses postgresql:// on port 5432, MySQL and MariaDB use mysql:// on 3306, Redis uses redis:// on 6379, and ClickHouse uses clickhouse:// on 9000.
A few cases are worth knowing. MongoDB clusters on Atlas use the mongodb+srv:// scheme, which finds its hosts from a DNS record and drops the port. SQL Server does not use a URI at all in the .NET world; it uses a key and value string like Server=host,1433;Database=mydb. The builder emits the right form for whichever database you pick, along with a JDBC line where it applies.
Passwords and special characters
The most common reason a hand written connection string fails is a password with a reserved character in it. An @, a :, or a / changes where the driver thinks the host begins. The builder percent encodes the username and password so the string stays valid, and decodes them again when you parse one back.
Because the tool runs entirely in your browser, a real connection string you paste in to inspect never leaves your machine. Nothing is sent to a server and nothing is saved.
Frequently asked questions
- What is a database connection string?
- A connection string is a single line that tells a client how to reach a database. It bundles the pieces of a connection together: the database type, the host, the port, the database name, and the credentials. Most databases accept it as a URI such as postgresql://user:password@host:5432/mydb, while SQL Server also uses a key and value format.
- What is the format of a PostgreSQL connection string?
- A PostgreSQL URI follows the pattern postgresql://user:password@host:port/database. The default port is 5432. To require an encrypted connection, add ?sslmode=require at the end. The scheme postgres:// works as an alias for postgresql://.
- How do I write a MySQL or MariaDB connection string?
- Use mysql://user:password@host:port/database, with 3306 as the default port. MariaDB accepts the same shape, and many drivers also read a mariadb:// scheme. Add ?ssl-mode=REQUIRED to force TLS.
- How is a MongoDB connection string different?
- MongoDB uses mongodb://user:password@host:27017/database. Managed clusters such as MongoDB Atlas use the mongodb+srv:// scheme instead, which looks up the hosts from a DNS SRV record and so leaves the port out. Toggle the SRV option in the builder to switch between the two.
- Does the builder handle special characters in passwords?
- Yes. A password that contains characters like @, :, or / would break a URI if written as is, so the builder percent encodes the username and password for you. Paste a working string back in and it decodes them again.
- Is anything I type sent to a server?
- No. The builder and parser run as JavaScript in your browser, so your host, database name, and credentials never leave your machine. You can safely paste a real connection string to inspect it.
More free tools
Skip the string with DB Pro
A connection string is how you tell a tool where your database lives. DB Pro turns that into a saved connection with a name, so you connect with a click instead of pasting a URI each time. It is a desktop database client for macOS, Windows, and Linux that works with PostgreSQL, MySQL, SQLite, MongoDB, Redis, and more.
Keep exploring the free tools, or read the database tutorials and cheat sheets.