Skip to content

wp-config.php Generator

Build a correct wp-config.php without copy-pasting from a 2014 blog post

Runs in your browser. Nothing is uploaded.

Database
Debugging
Hardening

Automatic core updates (WP_AUTO_UPDATE_CORE)

Not set leaves it to WordPress: a site first installed on 5.6 or later also takes major releases by itself, and Dashboard > Updates has a switch for it. Any other choice overrides that switch. Off stops security releases too, so a fix waits until someone updates by hand.

Limits
wp-config.php

Salts are generated in your browser with crypto.getRandomValues(). They are never sent anywhere — but for the record, WordPress's own api.wordpress.org salt endpoint is equally fine; it returns fresh random values over TLS.

About the wp-config.php Generator

Generate a wp-config.php with the constants you actually need: debug logging, memory limit, file-edit lockdown, core updates, table prefix and fresh salts.

The generator writes a whole wp-config.php: the database settings, eight new salts, the table prefix and the constants you tick. It does not ask for the database password, so DB_PASSWORD stays a placeholder that you fill in on your own computer. For what each part of the file does and how to edit it safely, read the wp-config.php guide.

Worked example: wp-config.php for a new shop

Input. Everything not listed was left at its default.

Database name:                          shop_live
Database user:                          shop_wp
Database host:                          localhost
Table prefix:                           shop_
Enable WP_DEBUG:                        off
Disable the theme & plugin file editor: on
Force SSL for the admin area:           on
Automatic core updates:                 Minor only
WP_MEMORY_LIMIT (MB):                   256
Post revisions to keep:                 10

Output, from running the tool's own script in Node.js with that input on 16 November 2026. The salts are random on every page load, so they are cut to 12 characters here (marked …). Nothing else is changed.

<?php
/**
 * wp-config.php — generated at odiethemes.com/tools/wp-config-generator
 *
 * Put your database password in below. It was deliberately not asked for:
 * a password should not be typed into a web page, even one that runs
 * entirely in your browser.
 */

define( 'DB_NAME', 'shop_live' );
define( 'DB_USER', 'shop_wp' );
define( 'DB_PASSWORD', 'put_your_password_here' );
define( 'DB_HOST', 'localhost' );
define( 'DB_CHARSET', 'utf8mb4' );
define( 'DB_COLLATE', '' );

/* Authentication keys and salts. */
define( 'AUTH_KEY', 'GY,b]STto!Vf…' );
define( 'SECURE_AUTH_KEY', ')5pG.N@Hl/q_…' );
define( 'LOGGED_IN_KEY', 'VycII/hn W%2…' );
define( 'NONCE_KEY', 'luY%ZQWm$S3o…' );
define( 'AUTH_SALT', 'X7.A_m0BW|mD…' );
define( 'SECURE_AUTH_SALT', 'Q)?kT<jIba{.…' );
define( 'LOGGED_IN_SALT', 'pmLWi@J2/<E6…' );
define( 'NONCE_SALT', '#~~. &g Ch!^…' );

$table_prefix = 'shop_';

/* Debugging. */
define( 'WP_DEBUG', false );

/* Hardening. */
define( 'DISALLOW_FILE_EDIT', true );
define( 'FORCE_SSL_ADMIN', true );
define( 'WP_AUTO_UPDATE_CORE', 'minor' );  // security and maintenance releases only

/* Limits. */
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_POST_REVISIONS', 10 );

/* That's all, stop editing! Happy publishing. */
if ( ! defined( 'ABSPATH' ) ) {
	define( 'ABSPATH', __DIR__ . '/' );
}
require_once ABSPATH . 'wp-settings.php';

What each part does:

  • DB_NAME, DB_USER and DB_HOST tell WordPress which database to open. localhost is right on most hosts, but some give you a separate database server name. If any of the three is wrong, WordPress stops with "Error establishing a database connection"; the database connection error guide covers what to check.
  • DB_PASSWORD is a placeholder. Replace put_your_password_here in your editor before you upload the file.
  • DB_CHARSET utf8mb4 and the empty DB_COLLATE are the same values as in WordPress's own wp-config-sample.php.
  • The eight keys and salts secure the login cookies and nonces. Changing them later signs everyone out: in our test (WordPress 7.1.4, PHP 8.3, WordPress Playground, November 2026), a logged-in admin was sent back to wp-login.php on the next request.
  • $table_prefix = 'shop_' names the tables shop_posts, shop_options and so on. Choose it before you install. In the same test, changing the prefix on a working site sent the home page and wp-admin to the WordPress installer, because WordPress could no longer find its tables.
  • WP_DEBUG false is the normal setting for a live site. To track down an error, use the WP_DEBUG code generator, which writes the lines that log errors to a file without showing them to visitors.
  • DISALLOW_FILE_EDIT removes the theme and plugin file editors from wp-admin.
  • FORCE_SSL_ADMIN sends the login page and wp-admin over HTTPS only. Turn it on after HTTPS works. On a site without HTTPS, our test showed wp-admin redirecting to its https:// address, which a site without a certificate cannot serve.
  • WP_AUTO_UPDATE_CORE 'minor' installs security and maintenance releases by itself, not major versions. Any value here also overrides the auto-update switch in Dashboard > Updates. Choose "Not set" if you want to keep that switch.
  • WP_MEMORY_LIMIT '256M' raises PHP's memory limit to 256 MB on every request when it is lower and the host lets PHP change it. It never lowers it. With PHP's limit set to 128M in our test, a 180 MB allocation failed without the line and worked with it. The memory exhausted guide explains the related WP_MAX_MEMORY_LIMIT, which applies to administrators in wp-admin and to image processing.
  • WP_POST_REVISIONS 10 keeps the 10 most recent revisions of each post. When a new one is saved, WordPress deletes the oldest (read from the WordPress 7.1.4 source).
  • The lines after "That's all, stop editing!" are the same as in wp-config-sample.php. They set ABSPATH and load WordPress, so every constant above has to come before them.

When to use it

Use it for a new install, or to rebuild a broken wp-config.php from a clean base. On a site that already runs, do not replace the whole file: copy only the lines you need into it, and keep its existing salts and table prefix. New salts sign everyone out, and a different prefix points WordPress at tables that do not exist.

Some settings have no field here: WP_HOME, WP_SITEURL, WP_MAX_MEMORY_LIMIT, the multisite constants and a custom content folder. Add those by hand, above the "stop editing" line.

If you have WP-CLI

On a server with WP-CLI, wp config create writes the file for you and generates the salts itself. The example in the WP-CLI documentation reads the password from a file, so it never appears on the command line:

wp config create --dbname=testing --dbuser=wp --prompt=dbpass < password.txt

It checks the database connection first unless you add --skip-check. Use --dbprefix to set the table prefix. --extra-php adds constants such as the ones above, but it reads that PHP code from STDIN, not from an argument. The documentation's example feeds it in with a heredoc and passes the password with --dbpass instead of a file.

Limits

  • It does not check anything against your server. It cannot tell whether the database details are right, whether HTTPS works, or whether your host allows PHP's memory limit to be raised.
  • The memory field sets WP_MEMORY_LIMIT only. It cannot raise PHP's upload limit; nothing in wp-config.php can. The upload size tool writes the PHP settings that do.
  • Choosing "Off" for core updates stops security releases as well. Only choose it if someone updates the site by hand.

Sources

Guides for this tool

Reference and related tools

FAQ

Questions

Is it safe to generate wp-config.php salts in a browser?

Yes. The salts are produced with crypto.getRandomValues(), the browser's cryptographically secure random number generator, and never leave your machine. For the record, WordPress's own api.wordpress.org salt endpoint is equally safe — it returns fresh random values over TLS. This is a convenience, not a security fix.

Why does this not ask for my database password?

Because you should not type a production database password into a web page, however trustworthy it claims to be. The generated file has a placeholder — fill it in locally, in your editor.

Can I change the table prefix on an existing site?

Not by editing wp-config.php alone. The prefix is also stored inside the data: the wp_user_roles option and usermeta keys such as wp_capabilities and wp_user_level carry it. Changing it on a live site means renaming every table and those keys as well. Choose it on a fresh install, or leave it alone.