01What is Connection String Parser?
A DATABASE_URL looks simple until one fails and you have to work out which part is wrong. This tool has two modes. Parse splits a URL-style connection string into its parts. Build assembles one from fields, with the escaping done for you. The format comes from the generic URI syntax in RFC 3986: scheme://user:password@host:port/database?options. PostgreSQL's libpq documents the same shape for postgresql:// URIs, and MongoDB, MySQL and Redis drivers use close variants. Parse needs a scheme at the start, so postgresql, mysql, mongodb, mongodb+srv, redis and similar names all work. Without one, nothing is shown. How does it split things? It drops any #fragment, cuts the query string at the first ?, then looks for the last @ before the path. That last @ separates the credentials from the host. So a password with a raw @ in it still parses, even though many drivers would reject it. The username, password and database are percent-decoded. Options go through URLSearchParams, so sslmode=require or replicaSet=rs0 show up as key and value pairs. Bracketed IPv6 hosts like [::1]:5432 keep their brackets. A comma-separated host list, as in a MongoDB replica set, is listed in full, and the Port row reads (per host). The password is shown as dots on screen. The Copy button gives you JSON with the password replaced by asterisks and the raw string left out, so you can paste it into a ticket. Nothing leaves the page and no connection is attempted. The tool tells you what the string says, not whether the server answers. Build works the other way. You pick a Protocol from postgresql, mysql, mongodb, mongodb+srv, redis, rediss or mssql. Then you fill in Host, Port, Database, Username and Password, and add Options as comma-separated key=value pairs. Credentials and the database name go through encodeURIComponent. For example, username app user and password p@ss:word on mongodb+srv with no port or database become mongodb+srv://app%20user:p%40ss%[email protected]/?retryWrites=true&w=majority. A bare IPv6 host gets brackets, and MongoDB URIs get the slash they need before the ?. Two limits to keep in mind. Semicolon-style strings such as Server=...;Database=... (ADO.NET, many JDBC setups) are not URLs, so Parse will not read them. Build also splits options on commas, so an option value that itself contains a comma cannot be entered there.
Backend and DevOps engineers who need to read, debug or safely assemble database URLs for Postgres, MySQL, MongoDB and Redis. The tool runs entirely in your browser, so your data never leaves your device.
02How to use Connection String Parser
- Choose Parse or Build at the top.
- In Parse mode, paste a string into Connection String and read the Protocol, Host, Port, Username, Password, Database and Options rows.
- In Build mode, pick a Protocol and fill in Host, Port, Database, Username and Password.
- Add extra settings in Options (comma-separated key=value), such as sslmode=require,connect_timeout=10.
- Click Copy to grab the masked JSON or the built string, or use the reset button to start over.
03Worked examples
- Input:
postgresql://admin:p%[email protected]:5432/mydb?sslmode=require - Result:
Protocol postgresql, Host db.example.com, Port 5432, Username admin, Password (masked, decodes to p@ss), Database mydb, Options sslmode=require - Percent-encoded characters in the user info are decoded, so %40 becomes @.
- Input:
postgres://user:p@ss@localhost/app - Result:
Host localhost, Port default, Username user, Password p@ss, Database app - The user info ends at the last @, so an unencoded @ in the password still parses; drivers may not be as forgiving, so encode it anyway.
- Input:
mongodb://u:pw@h1:27017,h2:27017,h3:27017/app?replicaSet=rs0 - Result:
Hosts h1:27017, h2:27017, h3:27017, Port (per host), Database app, Options replicaSet=rs0 - A comma-separated host list is shown as several hosts, each keeping its own port.
- Input:
postgresql://[::1]:5432/test - Result:
Host [::1], Port 5432, Database test - IPv6 addresses must be in square brackets so their colons are not read as the port separator.
- Input:
Build mode: protocol mongodb+srv, username "app user", password "p@ss:word", host cluster0.example.net, no port, no database, options retryWrites=true,w=majority - Result:
mongodb+srv://app%20user:p%40ss%[email protected]/?retryWrites=true&w=majority - Build mode percent-encodes the credentials and adds the / before ? that MongoDB URIs need when no database is given.
- Input:
localhost:5432/mydb - Result:
Nothing is parsed (no result) - The parser needs a scheme such as postgresql:// at the start.
04Common use cases
- Checking which host and database a DATABASE_URL in a .env file really points to before running a migration
- Assembling a Postgres URL with sslmode=require for a Heroku or Render deployment
- Debugging a MongoDB Atlas mongodb+srv URI that fails because of an unescaped character in the password
- Confirming every member and the replicaSet option in a self-hosted MongoDB replica-set URI
- Building a rediss:// URL with a password for a TLS-enabled Redis instance
- Sharing a masked copy of a connection string in a bug report without exposing the password
- Showing a junior developer how each part of a connection URL maps to a driver setting
05Tips
- Build percent-encodes passwords for you (@ becomes %40, : becomes %3A). If you hand-write a URL, do the same, because many drivers reject a raw @ or / in the password.
- mongodb+srv URIs must not include a port. The driver finds the hosts through DNS SRV records, so leave Port empty in Build mode.
- For Redis with only a password, the string starts redis://:secret@. Parse shows Username as (none) and the number after the slash as the Database.
- A Port row reading default means the string had no port, so the driver will use its own default.
- Clear the Database field in Build mode if you don't want a path. The field starts filled with mydb.
06Related concepts
connection URI, DATABASE_URL, sslmode, DNS SRV record, percent-encoding.
Frequently Asked Questions
What is Connection String Parser?
Connection String Parser is a free, browser-based developer tool on AIDToolStack. Parse/build database connection strings It requires no installation or sign-up and works entirely in your browser.
Is Connection String Parser free to use?
Yes. No sign-up, no fees and no usage cap.
Does Connection String Parser store my data?
No. It runs in your browser; nothing is uploaded.