Open your project in the Neon Console, click Connect in the Console nav, and copy the connection string from the Connect to your branch modal. You choose the branch, compute, database, and role, and the modal builds the string for that selection. The modal also shows connection examples for common frameworks and languages (Connect from any application).
Get the connection string
- Go to the Neon Console and open your project.
- Click Connect in the Console nav.
- In the Connect to your branch modal:
- Pick the branch. Your default branch is named
productionif you created the project in the Console, ormainif you created it with the CLI or API. - Pick the compute, database, and role.
- Leave Connection pooling on for a pooled string, which is the default and suits serverless and high-concurrency workloads. Turn it off to get a direct connection string.
- Pick the branch. Your default branch is named
- Click the copy icon next to the connection string.
A pooled Neon connection string looks like this:
postgresql://alex:AbC123dEf@ep-cool-darkness-a1b2c3d4-pooler.us-east-2.aws.neon.tech/dbname?sslmode=require&channel_binding=requireThe pieces:
alex: the roleAbC123dEf: the role's passwordep-cool-darkness-a1b2c3d4-pooler.us-east-2.aws.neon.tech: the hostname, which includes the compute ID (ep-...). The-poolersuffix appears only on pooled strings.dbname: the database namesslmode=require: requires an SSL/TLS connection, which Neon enforces for all connectionschannel_binding=require: adds SCRAM-SHA-256-PLUS channel binding for protection against man-in-the-middle attacks (Connect to Neon securely)
Most frameworks read this string from a DATABASE_URL environment variable. Assign it as-is.
Framework and language snippets
The same modal has connection examples for different frameworks and languages, built for the branch, database, and role you selected. Pick yours and copy the snippet.
For more in-depth setup, browse the framework guides and language guides. For edge and serverless runtimes that can't open TCP connections, see the Neon serverless driver.
CLI
To get the connection string from the terminal:
neon connection-stringPass the branch name as a positional argument, and use --database-name <db>, --role-name <role>, or --pooled to control the output. Without --pooled, the CLI returns a direct connection string. See neon connection-string.
Save it to a password manager
If you have the 1Password browser extension, the Connect modal shows a Save in 1Password button that saves the connection details to 1Password (Save your connection details to 1Password).

Use the pooler for serverless and high-concurrency workloads. Use the direct string for schema migrations, pg_dump, and logical replication.








