How to Install WordPress on Localhost (XAMPP/MAMP)

Published 16/09/25 · Read 3 minute

If you want to test, develop, or practice building a WordPress site without buying hosting, installing WordPress on your computer is the best option. This process is called running WordPress on localhost, meaning your site will only be accessible from your own machine.

With tools like XAMPP (for Windows/Linux) and MAMP (for macOS), you can set up a local server and install WordPress in just a few steps. This step-by-step guide will show you how.


Why Install WordPress on Localhost?

  • Test safely: Try new themes and plugins without affecting a live website.

  • Develop locally: Build custom themes or plugins offline.

  • Learn WordPress: Perfect for beginners who want hands-on experience.

  • Free setup: No hosting or domain needed.


Step 1: Download and Install XAMPP or MAMP

After downloading, install the software just like any other application.

XAMPP includes: Apache (server), MySQL (database), PHP, and phpMyAdmin.
MAMP includes: Apache/Nginx, MySQL, PHP, and phpMyAdmin.


Step 2: Start the Local Server

  • Open XAMPP Control Panel (Windows/Linux) and start Apache and MySQL.

  • Open MAMP (macOS) and click Start Servers.

Once running, your local server is live.


Step 3: Create a Database for WordPress

  1. Open your browser and go to:

    • http://localhost/phpmyadmin (XAMPP)

    • http://localhost:8888/phpmyadmin (MAMP default port)

  2. Click Databases.

  3. Enter a name (e.g., wordpress_local) and click Create.


Step 4: Download WordPress

  • Go to wordpress.org and download the latest version.

  • Extract the WordPress folder.

  • Move it into your server directory:

    • XAMPP: htdocs folder (e.g., C:/xampp/htdocs/wordpress)

    • MAMP: htdocs folder (e.g., /Applications/MAMP/htdocs/wordpress)


Step 5: Install WordPress via Setup Wizard

  1. In your browser, visit:

    • http://localhost/wordpress (XAMPP)

    • http://localhost:8888/wordpress (MAMP)

  2. Choose your language.

  3. Enter your database details:

    • Database name: (e.g., wordpress_local)

    • Username: root

    • Password: leave blank for XAMPP / root for MAMP

    • Host: localhost

  4. Run the installation.

  5. Enter your site details (site title, username, password, email).

Congratulations 🎉 You now have WordPress running locally!


Step 6: Log In to WordPress Dashboard

  • Go to:

    • http://localhost/wordpress/wp-admin

  • Enter your login credentials.

  • Start customizing your site just like a live WordPress installation.


Tips for Using WordPress on Localhost

  • You can install multiple WordPress sites by creating new folders in htdocs and new databases.

  • Always keep XAMPP or MAMP running while working on your site.

  • Use tools like Duplicator or All-in-One WP Migration if you want to move your local site to live hosting later.


FAQ

Q: Can I run WordPress locally without XAMPP or MAMP?
Yes, you can use alternatives like Local by Flywheel, WAMP, or Docker.

Q: Can others access my localhost WordPress site?
No, unless you configure port forwarding or use tools like Ngrok. By default, it’s only available on your computer.

Q: Is localhost WordPress the same as live WordPress?
Yes, it works the same, except it’s offline. Once moved to hosting, it becomes a live site.

Q: Can I move my localhost site to a live server later?
Yes. You can use migration plugins or manually export the database and files.