How to Install WordPress on Localhost: A Step-by-Step Guide

Setting up WordPress on your localhost is an excellent way to experiment with the platform, test themes and plugins, and develop your website before going live.

In this step-by-step guide, we’ll walk through the process of installing WordPress on localhost using a popular tool called XAMPP.

Table of Contents #
  1. Introduction
  2. Prerequisites
  3. Download and Install XAMPP
  4. Start XAMPP Services
  5. Create a Database for WordPress
  6. Download and Install WordPress
  7. Run the WordPress Installation
  8. Complete WordPress Setup
  9. Accessing Your Local WordPress Site
  10. Conclusion

1. Introduction

WordPress is a versatile and widely-used content management system (CMS). Installing it on localhost allows you to work on your website locally before making it live on the internet.

2. Prerequisites

Before you begin, ensure that you have the following:

  • A computer (Windows, macOS, or Linux)
  • Internet connection (for downloading software)
  • Basic computer skills

3. Download and Install XAMPP

XAMPP is a free and open-source cross-platform web server solution stack. Follow these steps:

  1. Go to the XAMPP download page.
  2. Choose the version suitable for your operating system (Windows, macOS, or Linux).
  3. Download the installer and run it.
  4. Follow the on-screen instructions to install XAMPP with the default settings.

4. Start XAMPP Services

After installing XAMPP, start the Apache and MySQL services:

  1. Open the XAMPP Control Panel.
  2. Start the Apache and MySQL modules by clicking on the “Start” buttons next to them.
XAMPP start apache and mysql server

5. Create a Database for WordPress

Learn: How to Create a Database using phpMyAdmin?

  1. Open your web browser and go to http://localhost/phpmyadmin.
  2. Click on “Databases” in the top menu.
  3. Enter a database name what you want (e.g., wordpress) and click “Create”.
  4. Remember your database name which will need further. I have created a database for myself called my_wp_site which I will use further and you will use your own DB name in those places.

6. Download and Install WordPress

  1. Download WordPress

    Download the latest version of WordPress from the official WordPress website (

  2. Extract the downloaded ZIP file

    Extract the downloaded ZIP file to the htdocs folder in your XAMPP installation directory.

    To find the “htdocs” folder, click “Explorer” on your XAMPP control panel.

    Explorer Button of XAMPP control panel

    After that, you can see the htdocs folder like the following image:

    htdocs folder location
  3. Rename the “wordpress” folder

    After extracting the downloaded ZIP inside the “htdocs” folder, you can see the “wordpress” folder.

    Rename the “wordpress” folder with the name you want to call your WordPress site. For Example I called it mysite.

7. Run the WordPress Installation

To run the installation setup, Open your web browser and go to:


In My Case: "http://localhost/mysite" Because I renamed the "wordpress" folder to mysite.

8. Complete WordPress Setup

  • Select your language and click “Continue.”
    wordpress installation select language and continue
  • Click on the “Let’s go!” button:
  • Enter Database Connection Details:
    • Database name: my_wp_site (Your Database Name)
    • Username: root
    • Password: By default Password is empty.
    • Database Host: localhost
    • Table Prefix: For local WordPress installation it is ok to go with wp_. But, in production you need to change something else.
    enter database connection details for installing wordpress locally

    After putting the database details, click on the “Submit” button.

    If you have entered all the details of your DB correctly you will see the “Run the installation” button, Just click on it.

  • Enter you Site Information:
    • Site Title: “Enter Your Site Title”
    • Username: “Enter new username”. It is ok to give “admin” username when you do locally, but In production you need to strong username.
    • Password: “Enter Strong Password” for local Installation you can git weak password like 1234 but you need to check “Confirm use of weak password”.
    • Your Email: “Enter your email address”
    • Check all the details and remember the username and password, then click on the “Install WordPress” button to install.
    wordpress installing site information step

9. Accessing Your Local WordPress Site

Once installation is complete, log in using the admin credentials. You can now access your local WordPress site at http://localhost/wordpress (replace “wordpress” with your folder name).

Login to your WordPress Site’s Dashboard:

Go to your WordPress site’s login page, In my case: http://localhost/mysite/wp-admin

Enter your username and password to login:

WordPress Login page

Here is the WordPress Dashboard image after login:

WordPress Dashboard Image

Here is how the sites looks:

WordPress site on localhost

10. Conclusion

Congratulations! You’ve successfully installed WordPress on your localhost using XAMPP.

You can now explore WordPress, install themes and plugins, and start building your website in a local environment. Remember that this setup is for testing and development purposes.

When you’re ready to launch your site, you’ll need to choose a web hosting provider for the live deployment.