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.
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_USERandDB_HOSTtell WordPress which database to open.localhostis 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_PASSWORDis a placeholder. Replaceput_your_password_herein your editor before you upload the file.DB_CHARSETutf8mb4and the emptyDB_COLLATEare 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_DEBUGfalse 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_EDITremoves the theme and plugin file editors from wp-admin.FORCE_SSL_ADMINsends 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_REVISIONS10 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
- WordPress wp-config.php: What It Does and How to Edit It
wp-config.php holds your WordPress database login, security keys and site settings. See where it lives, what each part does and how to edit it safely.
- WordPress Debug Mode: How to Enable WP_DEBUG Safely
Turn on WordPress debug mode with WP_DEBUG, log errors without showing them to visitors, and switch it off again. Copy-paste wp-config.php code included.
- WordPress Debug Log Location: Find and Move debug.log
Find the WordPress debug log location, move debug.log outside the web root so visitors cannot fetch it, and fix the WP_DEBUG settings that leave it empty.
- WordPress Search Replace Database URL Without Breaking Data
Change a WordPress site URL in the database without blanking widgets, menus or theme settings. Use the WP-CLI command that keeps serialized data intact.
- How to Increase the Upload Limit in WordPress on Any Host
Check your current WordPress upload limit, then raise it in the right place for your host: php.ini, .user.ini, .htaccess, cPanel, Nginx or Cloudflare.
- Fix "Allowed Memory Size Exhausted" in WordPress
Clear WordPress's "allowed memory size exhausted" fatal error with one wp-config.php line, then find out if your host caps PHP or a plugin is leaking.
Reference and related tools
- WordPress Hooks Index
Actions and filters with the signature, the source line and the gotcha
- WordPress WP_DEBUG Code Generator for wp-config.php
Turn on the debug log without breaking your live site
Related
Other tools you might need
WordPress WP_DEBUG Code Generator for wp-config.php
Turn on the debug log without breaking your live site
WordPress Max Upload Size Fixer for php.ini & .htaccess
Raise the upload limit with the PHP values in the right order
WordPress .htaccess Generator
The rules WordPress needs, plus the hardening rules it does not ship with
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.