Database URL Parser
Parse a DATABASE_URL for PostgreSQL, MySQL, Redis or MongoDB into host, port, user, password and options, and convert it to Laravel, Django, JDBC and CLI formats.
Free · No sign-up · Your inputs stay in your browser
Input
Parse a database connection URL
Output
Components
| Engine | postgres |
|---|---|
| Host | db.internal.example.com |
| Port | 5432 |
| User | app_user |
| Password | ••••••••• |
| Database | app_production |
| ?sslmode | require |
| ?application_name | web |
Laravel .env
DB_CONNECTION=pgsql DB_HOST=db.internal.example.com DB_PORT=5432 DB_DATABASE=app_production DB_USERNAME=app_user DB_PASSWORD=•••••••• DB_SSLMODE=require
Django settings
DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql", "HOST": "db.internal.example.com", "PORT": "5432", "NAME": "app_production", "USER": "app_user", "PASSWORD": "••••••••", "OPTIONS": {"sslmode": "require", "application_name": "web"}, } }
JDBC
jdbc:postgresql://db.internal.example.com:5432/app_production?sslmode=require&application_name=web
CLI
PGPASSWORD='••••••••' psql -h db.internal.example.com -p 5432 -U app_user -d app_production
Percent-encoded characters in the user and password are decoded: a password containing @, / or : has to be encoded in the URL, as %40, %2F and %3A, or the parser splits it in the wrong place. That is the usual reason a DATABASE_URL that looks right fails to connect.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
Percent-encoding is the usual bug
A URL reserves @, :, / and ? as separators, so a password containing any of them must be percent-encoded (@ as %40, / as %2F), or the parser splits the URL in the wrong place and the error mentions an unknown host. Hosting providers that hand out a DATABASE_URL encode it for you; one assembled by hand often is not. RFC 3986 defines the syntax.
Laravel reads it directly
Laravel's database config accepts a DB_URL (DATABASE_URL in older versions) and splits it with the same rules, so a provider's URL can be used as is. Explicit DB_HOST style variables are easier to read and override one at a time.