Connection string builder
Fill in host, user and password, or paste an existing string, to get a correctly encoded URI, key/value and JDBC forms, .env lines and code for your driver.
- PostgreSQL, MySQL, MongoDB, SQL Server, Redis
- Free, no sign-up
Everything is built in this tab. The password field is never saved, never put in the page address and never sent anywhere.
Start from an existing connection string
Connection URI
Key/value
JDBC URL
.env lines
Your code reads DATABASE_URL. Keep this file out of version control.
Node.js
Python
Runs in your browser. Nothing you type or open is uploaded. Free to use, no account. More code and data tools
How to build a connection string
- Choose the database, or a preset for Supabase, Neon, MongoDB Atlas or Amazon RDS. Presets fill in the provider's host pattern, port, user format and TLS options; replace the parts in capitals with your own values.
- Enter the host, port, database, user and password. The connection URI, key/value form, JDBC URL, .env lines and code snippets update as you type.
- Read the checks under the fields. They catch the mistakes behind most connection failures, such as a Supabase pooler user without the project reference or a mongodb+srv address with a port.
- Copy the form your driver or tool expects. To fix a string you already have, open Start from an existing connection string, paste it and read it into the fields.
Special characters in passwords
In a URI, the characters @ : / ? # [ ] % and spaces have a meaning, so a password that contains them must be percent-encoded: p@ss#1 becomes p%40ss%231. An unencoded @ in the password is the classic reason for errors like "could not translate host name" or "getaddrinfo ENOTFOUND", because the driver reads the rest of the password as the host name.
This tool encodes the user and password in every URI form, and quotes them instead in key/value forms, where encoding isn't used: libpq wraps values in single quotes, and ADO.NET wraps values that contain a semicolon in double quotes. To encode a single value by hand, use the URL encoder.
URI, key/value and JDBC forms
PostgreSQL accepts both postgresql://user:password@host:5432/db?sslmode=require and the key/value form host=host port=5432 dbname=db user=user; psql, psycopg, node-postgres and most ORMs take either. Several hosts, separated by commas, let libpq try each in turn, and target_session_attrs=read-write makes it pick the primary.
SQL Server tools expect the ADO.NET form Server=tcp:host,1433;Database=db;User ID=user;Password=...;Encrypt=True;. Java applications use JDBC URLs, which keep the user and password out of the URL in most tools: enter those in the tool's own fields. MongoDB and Redis drivers take the URI only.
For MongoDB, mongodb+srv:// takes one host name with no port; the driver looks up the actual servers in DNS and turns on TLS. A plain mongodb:// address lists every replica set member with its port.
Supabase, Neon and other hosted databases
Supabase's shared pooler uses the user postgres.<project-ref>, port 6543 for transaction mode (serverless functions) and 5432 for session mode. Its host includes a pooler cluster number, so copy it from the Connect dialog rather than building it from the region. In transaction mode, turn off prepared statements in your driver; for Prisma that means adding pgbouncer=true. Direct connections to db.<project-ref>.supabase.co use IPv6 unless the project has the IPv4 add-on.
Neon adds -pooler after the endpoint ID for pooled connections and requires TLS. For any hosted PostgreSQL, add sslmode=require at least, or verify-full with the provider's root certificate so the client also checks it is talking to the right server.
Keeping connection strings safe
A connection string with a password is a credential. Keep it in your platform's secret store or a .env file that is listed in .gitignore, read it from an environment variable in code (as the snippets on this page do), and rotate the password if the string ever lands in a commit, a log or a chat. A long random password from the password generator avoids special-character trouble and is hard to guess.
Private by design
Privacy
This page builds the strings in your browser tab and makes no network request with them. The password field is never saved and never put in the page address, and the outputs show it masked until you tick Show password. The other fields are kept for this tab only, so a reload doesn't lose your work; the database type is remembered as a setting. Copy buttons copy the real value, including the password.
This page also shows Google ads, which can use cookies. Privacy and cookies explains how.
Link to this tool
Found it useful? You're welcome to link to it from your README, docs or blog.
Questions
How do I put a password with special characters in a connection string?
Percent-encode it in URI forms: @ becomes %40, # becomes %23, / becomes %2F and : becomes %3A. Type the password here and the URI is encoded for you; key/value forms quote it instead.
What is the Supabase pooler connection string?
postgresql://postgres.<project-ref>:<password>@<pooler-host>:6543/postgres for transaction mode, or port 5432 for session mode. Copy the pooler host from Connect in the Supabase dashboard and use the Supabase preset here to check the rest.
Why does mongodb+srv fail when I add a port?
An SRV address names a DNS record that lists the servers and their ports, so it can't carry a port or several hosts. Remove the port, or switch off SRV and list each host with its port.
What is the difference between sslmode=require and verify-full?
require encrypts the connection but accepts any server certificate. verify-full also checks the certificate against a root certificate (sslrootcert) and the host name, which stops someone impersonating the server.
Is the password sent or saved anywhere?
No. This page makes no network request with what you type, the password field is never saved or put in the address, and it stays masked in the output until you choose to show it.
From the same developer
- URL encoder: percent-encode a single value by hand.