In the simplest, most human-friendly terms, "localhost" means "this computer".\r\n\r\nSpecifically, it means "the computer that a program is running on". Depending on what program you're talking about, that can mean <em>your own computer<\/em>, or it can mean <em>your web server<\/em>.\r\n\r\nFor example, if you're talking about the web browser that you're using to view this very page, "localhost" means "your computer". But if you're working in a WordPress plugin on your live website, "localhost" means your web server because the WordPress software is located on your web server (<em>not your own computer<\/em>).\r\n\r\nBasically, it's "this computer" <em>from the perspective of the program that you're using<\/em>, not necessarily <em>your own perspective<\/em>.\r\n<h2>Some More Technical Details About How Localhost Works<\/h2>\r\n<h3>Localhost IP Address<\/h3>\r\nBy default, localhost resolves to 127.0.0.1 when using IPv4 and ::1 when using IPv6.\r\n\r\nLocalhost uses the loopback network interface, which means that any data sent to localhost is automatically routed back without any modification.\r\n<h3>You Cannot Register A .localhost Domain Name<\/h3>\r\n<a href="https:\/\/tools.ietf.org\/html\/rfc2606" target="_blank" rel="noopener noreferrer">Since 1999<\/a>, localhost is officially a reserved top-level DNS name. That means you cannot register a domain name with the extension ".localhost". The reason for this is so that developers can safely test websites using the .localhost extension (<em>which you'll see in a second<\/em>).\r\n<h2>How Does Localhost Connect To WordPress?<\/h2>\r\nThough localhost is a general networking term, you'll often see it referenced while you're working with WordPress.\r\n\r\nIt could come up in plenty of different places, but here are a few of the most common spots that you'll see localhost referenced with WordPress.\r\n<h3>1. Localhost WordPress Development<\/h3>\r\nWhen developers build WordPress sites, they normally don't install WordPress on a live web server or <a href="https:\/\/pagely.com\/blog\/wordpress-staging-site-create\/">a staging site<\/a> right away.\r\n\r\nInstead, they install WordPress "locally" on their "localhost". If you recall the definition from the beginning of this article, that means that WordPress is running on their own computer, rather than a web server.\r\n\r\nThis allows developers to easily work in a safe sandbox while building the site. Once the WordPress site is ready to go live, developers will migrate it from their localhost to a live web server.\r\n\r\nThere are several popular tools that you can use to set up <a href="https:\/\/pagely.com\/blog\/free-wordpress-developer-tools\/">your own localhost WordPress development environment<\/a>. Some good options are:\r\n<ul>\r\n \t<li><a href="https:\/\/www.apachefriends.org\/index.html" target="_blank" rel="noopener noreferrer">XAMPP<\/a><\/li>\r\n \t<li><a href="https:\/\/www.mamp.info\/en\/" target="_blank" rel="noopener noreferrer">MAMP<\/a><\/li>\r\n \t<li><a href="http:\/\/www.wampserver.com\/en\/" target="_blank" rel="noopener noreferrer">WAMP<\/a><\/li>\r\n \t<li><a href="https:\/\/serverpress.com\/" target="_blank" rel="noopener noreferrer">DesktopServer<\/a> - a WordPress-specific solution.<\/li>\r\n<\/ul>\r\nFor example, if you use the XAMPP software, you'll then be able to access your local development sites using "localhost\/<strong>folder_name<\/strong>":\r\n\r\n<img class="aligncenter size-full wp-image-620" src="https:\/\/pagely.com\/kb\/wp-content\/uploads\/2018\/09\/what-is-localhost-3.png" alt="localhost wordpress development" width="1005" height="284" \/>\r\n\r\nAnd because "localhost" is a loopback address, you could also enter the localhost IP address to access the same local development site:\r\n\r\n<img class="aligncenter size-full wp-image-621" src="https:\/\/pagely.com\/kb\/wp-content\/uploads\/2018\/09\/what-is-localhost-4.png" alt="localhost loopback example" width="962" height="241" \/>\r\n\r\nThat is, both "localhost" and "127.0.0.1" take you to the exact same place.\r\n<h3>2. Your Site's wp-config.php File<\/h3>\r\nYour WordPress site's <strong>wp-config.php<\/strong> file is the core configuration file for various WordPress settings. One of the things wp-config.php is responsible for is controlling your WordPress site's database, including its location.\r\n\r\nIn most situations, your WordPress site's database is hosted on the same server as the WordPress software.\r\n\r\nBecause the database software is running on the same server as the WordPress software, your <strong>wp-config.php<\/strong> file typically defines the database's location as "localhost":\r\n\r\n<img class="aligncenter size-full wp-image-618" src="https:\/\/pagely.com\/kb\/wp-content\/uploads\/2018\/09\/what-is-localhost.png" alt="localhost in wp-config.php file" width="660" height="423" \/>\r\n\r\nWhile you're unlikely to work with your <strong>wp-config.php<\/strong> file on a daily basis, you'll also encounter this same principle if you ever use a WordPress migration plugin. Speaking of...\r\n<h3>3. Any Plugin That Involves Your Database<\/h3>\r\nFor the same reason as above, you'll often encounter localhost when you're working with any plugin that involves your WordPress site's database.\r\n\r\nFor example, when you use the Duplicator migration plugin, you have an option to specify the "Host" for the destination MySQL database:\r\n\r\n<img class="aligncenter size-full wp-image-619" src="https:\/\/pagely.com\/kb\/wp-content\/uploads\/2018\/09\/what-is-localhost-2.png" alt="localhost in duplicator plugin" width="948" height="556" \/>\r\n\r\nIn most situations, you'll enter localhost in this box. Again, that's because the MySQL database is running on the same server as the WordPress software.\r\n\r\n<strong>And that's all most WordPress users need to know about localhost!<\/strong>\r\n\r\nRemember, an easy shorthand is to just think of localhost as "this computer". Just remember that you need to think about it <em>from the perspective of the program that you're working with<\/em>!