Geekflare is supported by our audience. We may earn affiliate commissions from buying links on this site.
In WordPress Last updated: July 31, 2023
Share on:
Invicti Web Application Security Scanner – the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning™.

Do you want to install WordPress on localhost?

Installing WordPress locally means hosting your website on your local computer. Your computer acts as the hosting provider for your website. Your files will be stored on your local computer, and only you can access your site.

To install WordPress on localhost, you need two free tools – a local development tool like XAMPP, LAMP, MAMP, or WAMP and WordPress installer.

Generally, if you want to build a WordPress website, you need to purchase a domain name and hosting and then launch a live website. However, if you just want to try and test a few things on a WordPress website, installing it locally is the best solution.

You won’t have to spend a dime on hosting or domain; you can do all your testing and development for free. Also, if you just want to learn how to create WordPress websites, then hosting WordPress locally is recommended.

This article will cover how to install WordPress on localhost installation in five easy steps. I will do this installation using the XAMPP localhost software, as it supports various operating systems (Windows, Linux, and Mac) and is free to use.

So, let’s dive into the article.

Benefits of Installing WordPress on Localhost

No doubt, WordPress is one of the most popular CMS in the world. According to CMS Market Share Report 2023, WordPress powers more than 43% of all websites on the internet.

When you install WordPress CMS locally, the entire website is hosted on a local computer machine. The website connects with the local machine with the help of a loopback address network instead of connecting to a remote server over the internet. Hence, it’s called local hosting.

Here are some benefits of installing WordPress on a localhost:

#1. Learning and Development

If you are a novice WordPress developer or want to get into WordPress development, local hosting can help you polish your developing skills. Local WordPress development is especially beneficial for students as this is an absolutely free process.

The best thing is you can learn at your pace.

#2. Safe Space for Testing New Plugins, Features, and Themes

Testing new plugins, features, or themes on a live website can break the website code and crash it. This will not only harm the real-time users but also your business revenue.

By installing WordPress locally, you have a safe location to test out new plugins, features, or themes.

#3. Isolated Dev Environment

Installing WordPress on localhost gives you an isolated environment to develop new tools and techniques with zero risk and optimum flexibility. In web development, you need an environment to play around with the code while testing ideas.

Once the feature/plugin/theme is finalized, you can move it to a test site for QA and improvements.

How to Install WordPress on a Localhost?

So, now that you know the benefits of hosting WordPress locally let’s see the practical step-by-step guide on how to do it right.

Install a Local Development Tool (XAMPP, WAMP, MAMP, LAMP)

The web development environment allows us to develop web applications locally (offline). To develop any web applications, we must first set up a web development environment on our local machine, i.e., in our computer system. 

On setting up a web development environment, we convert our local machine to behave as both clients as well as the server. To set up a web development environment for developing web applications using PHP and MySQL

According to the system specification, we need to install one of the below-mentioned software packages.

Localhost SoftwareStands For
XAMPPCross-platform, Apache, MySQL, PHP, and Perl
WAMPWindows, Apache, MySQL, PHP
LAMPLinux, Apache, MySQL, and PHP
MAMPMy Apache, MySQL, and PHP

If you want to know more about localhost software, read our complete guide on XAMPP, WEMP, LAMP, and more.

Today, I will be using XAMPP because it runs on any OS (Windows, Mac, or Linux). Compared to other platforms, XAMPP offers more features, and it has a beginner-friendly interface.


You can download any XAMPP version, but I recommend installing the latest one. Once the installer is downloaded, you can start the installation process.

Just open the installer, and click on the next button until XAMPP unpacks its files.


Let XAMPP unpack its files, and the software will be installed. This might take a few minutes.


Configuring the Local Server Environment for WordPress Installation

Whenever you want to create a project (website) in WordPress, you need to configure the local server environment first. Only then you’ll be able to install WordPress on your local computer.

Once XAMPP is installed, a window will open up. You must start the Apache and MySQL modules before you install WordPress. Once the modules turn green, it means you can proceed further.


You might also get a prompt with “Windows Defender Firewall has blocked some features of this app”. If this happens, then click on Allow Access.

Once done, minimize this window. Do not close it; just minimize it.

Downloading and Installing WordPress

Now that the local server environment is set, you can install WordPress.

Head to and install the latest version.


Once the zip folder has been downloaded, head to the drive where you have installed XAMPP, open the folder and then open the htdocs folder. Paste the WordPress zip folder in the htdocs folder.


Once you have pasted the zip folder, extract the WordPress files.


Once the folder is extracted, you can rename the folder. Name the folder whatever you want to name your project (website).


Keep in mind that you have just installed the WordPress files required to install WordPress on your local computer; you haven’t installed the WordPress CMS itself.

WordPress creates dynamic websites, and these dynamic websites need a database to function. If you remember, we started the MySQL database in XAMPP. Now we need to create a new database to install WordPress on localhost.

Creating a Database for WordPress

To create your MySQL database, open a browser, go to localhost/phpmyadmin/, and start creating your database. 

Remember that your Apache and MySQL modules in the XAMPP dashboard must be on; otherwise, this tab won’t open.


Click on Databases and create a database. Once you name your database, click on Create.


Note: You have to create a new database whenever you create a new project (website).

Configure WordPress Settings

Now we need to start the WordPress setup. Your local machine will act as your host. So, you need to go to your browser and type in the search bar – localhost/<wordpress-folder-name>.

I created it with the name “WordPress”, so I will type – localhost/wordpress/. When you hit enter, you will see this page.


Select the language you want to install your WordPress in and click Continue.

WordPress will ask you to configure your database. Click on Let’s Go. In the next window, enter your database connection details. Please ensure that you put the correct name in the “Database Name” space.

Otherwise, you will not be able to configure your WordPress settings.

I created a database named “wordpress”, so I will insert it as it is.


Remember that your username will always be root when installing WordPress on a localhost. Keep the password section blank and Database Host as localhost only.

No need to do anything in Table Prefix either. Just click on Submit.

When you see this popup, click on Run the Installation.


Now, you have to add some more information to create your WordPress website.


Add a Site Title and your username. You can create any password you want here; you will be able to change it afterward from the WordPress backend dashboard. Add your email too.

Check the Search Engine Visibility box if you do not want Google bots to crawl your website. This means Google won’t find the pages and blogs of your website and thus won’t rank on the search engine.

Most of the time, web developers or companies do not want their locally hosted WordPress websites to be ranked on Google as they are created just for testing and development and not for business purposes.

If you want your local website to be found by Google, keep it unchecked.

Once done, click on Install WordPress.

You will see a success message and a Login button.


Enter your login credentials and open your WordPress website. The website will have a default theme, but you can customize it using WordPress’s Gutenberg block editor.


If you do not want to customize the default theme, you can add a new one. Just go to Appearance >> Themes >> Add New.


Voila, you have installed WordPress on localhost!

Now go ahead and do your testing and development without any worry about your main website breaking down.

Common Errors During Local WordPress Installation and How to Troubleshoot Them

During local WordPress installation, some users might encounter common errors. Let’s discuss these errors along with some troubleshooting tips.

Error Establishing a Database Connection

Database connection error occurs when WordPress fails to connect to your MySQL database during installation. Check the database credentials and the name of the database and ensure they match the database you created.

Failed to Connect to the FTP Server

This error occurs when WordPress fails to connect to the FTP server while installing themes or plugins. This happens mostly when you insert incorrect FTP credentials. 

404 Page Not Found Error

This error happens when WordPress cannot locate a specific page or post. To fix this, check your permalink settings and ensure they are set to “Post name” or a custom structure.

HTTP Error When Uploading Images

There are various reasons for this error. Some of the most common ones are a file size limit or a low PHP memory limit. To fix this issue, you need to increase the PHP memory limit and maximum file size in your php.ini file.

White Screen of Death

Do you know the blue screen of death error in Windows? The white screen of death is a similar error for WordPress. This error is mostly caused by themes or plugins conflict. 

So, switch to a default theme or try disabling your plugins one by one to see which one is causing the issue.

Read our complete guide on White Screen of Death error.

Final Thoughts

Using XAMPP, you can install WordPress locally on any device, be it Windows, Mac, or Linux. This step-by-step guide will help you to install WordPress on localhost.

You are free to experiment with different WordPress themes, plugins, and customization options. Whether you are a beginner or a WordPress expert, hosting WordPress locally provides a secure and controlled environment to learn, test, and enhance your web development skills.

What to read next? Read about the best WordPress plugins to convert WordPress sites to mobile apps.

  • Rohit Mane
    Rohit is a freelance SEO content writer and a B2B SaaS marketing copywriter. He writes about topics such as WordPress plugins for WooCommerce and SaaS tools such as sales funnel builders, email marketing automation, and WordPress marketing…. read more
  • Rohit Mane
    Rohit is a freelance SEO content writer and a B2B SaaS marketing copywriter. He writes about topics such as WordPress plugins for WooCommerce and SaaS tools such as sales funnel builders, email marketing automation, and WordPress marketing…. read more
Thanks to our Sponsors
More great readings on WordPress
Power Your Business
Some of the tools and services to help your business grow.
  • Invicti uses the Proof-Based Scanning™ to automatically verify the identified vulnerabilities and generate actionable results within just hours.
    Try Invicti
  • Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data.
    Try Brightdata
  • is an all-in-one work OS to help you manage projects, tasks, work, sales, CRM, operations, workflows, and more.
    Try Monday
  • Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches.
    Try Intruder