What is Localhost?

Localhost is available on most computers, usually to display web pages. It's also useful to use to learn coding on your computer.

Recently while reading the news wire for this magazine, crammed in between amazing headlines titled Sudden Progress on Prime Number Problem Has Mathematicians Buzzing, Own a Street-Legal Flamethrowing Batmobile Replica for Just $200K, and Absurd Creature of the Week: This Parasite Eats a Fish's Tongue "” And Takes Its Place (with a disgusting photo!), I noticed an article titled Quickly Preview Localhost Project with Sublime Text.

At the risk of losing readers, links to the articles about Batmobiles, prime numbers, and disgusting parasites are at the bottom of this article.

The last article, however, got me thinking I should write about localhost. If you own an Apple computer, for example, you might not realize your computer includes a web server, Python, and a few other goodies for programmers and soon-to-be programmers. Localhost is a key gateway to use this stuff.

What is localhost? It’s a name and address, usually used by a web browser to find a web server on your computer. Instead of typing myfavoritewebsite.com you type localhost in the URL bar of your web browser. If your computer has a web server, and is configured properly, you will see a basic web page. On Grendel, my ancient iMac, calling up localhost in my browser displays a message, “It works! And unlock!” No idea the last bit — what unlocked?

Localhost like any self-respecting website address also has a unique IP address: typing in the URL bar of your web browser displays the same results as typing in localhost. What’s an IP address? IP stands for internet protocol which refers to a set of standards (protocols) used to communicate on the internet. Imagine if every computer on the internet spoke a different language. Because computers transfer data with the same standards, data moves quickly and efficiently. Your web pages and email show up as you (hope and) expect.

The difference between localhost and any URL like myfavoritewebsite.com is localhost traffic never travels on a network. Data is transmitted within your computer. People typically use localhost to do web-based software development on their computer then transfer files to a remote web server for test and launch.

Technically, localhost is called a hostname. A hostname is a label assigned to a computer on a network, for example, www.nytimes.com is a label assigned to the computers that host the New York Times website on the internet network. Their website also has an IP address computers actually use to deliver data between their servers and your web browser. But you rarely if ever see the New York Times IP address. You only see the hostname, www.nytimes.com, in your web browser.

Another interesting detail about localhost is that it uses the http protocol. While you can type www.nytimes.com or nytimes.com into the URL bar of any web browser, sometimes the hostname has http:// or https:// added to the front, as in http://www.nytimes.com. The http bit stands for hypertext transfer protocol. Like IP addresses, http is another internet standard used by computers to communicate with each other. However, there are other protocols you can use locally, for example, file:// works in some web browsers to display files on your computer. And ftp:// in some web browsers displays folders and files stored on remote computers after you login to the remote computer.

If you’re a programmer and want to use localhost to display web pages, there are a few ways to make it happen. If your computer does not include a web server, you can use XAMPP to install Apache (web server), MySQL (a database), and the PHP programming language. These are all free open source software technologies. If you have an Apple computer, the Library/Web Server/Documents folder should be the root folder of your web server.

Once you find the folder for your local web server, whether the server is included (Mac OS X) or added (XAMPP or similar), the next steps are to add any additional languages you need then start coding. You can use localhost to view your web pages.

Learn More





Sudden Progress on Prime Number Problem Has Mathematicians Buzzing


Own a Street-Legal Flamethrowing Batmobile Replica for Just $200K


Absurd Creature of the Week: This Parasite Eats a Fish's Tongue "” And Takes Its Place


Quickly Preview Localhost Project with Sublime Text



  • Tim Slavin

    Tim is an award-winning writer and technologist who enjoys teaching tech to non-technical people. He has many years experience with web sites and applications in business, technical, and creative roles. He and his wife have two kids, now teenagers, who are mad about video games.

Also In The December 2013 Issue

Siblings Pete and Alexa Ingram-Cauchi Talk iD Tech and Tech Summer Camps

They talk about how they started and run iDTech summer camps together and how parents can evaluate tech summer camps.

Where to Recycle Electronics

Here are a few places where you can recycle your old electronics safely.

What is a High Level Language?

What are the differences between high level languages and machine languages? And how do these differences impact coding?

An Interview with Boone Gorges

Learn how a humanities PhD became a software programmer who builds online communities for universities, as well as Lead Developer for BuddyPress and helping to create WordPress plugins like Anthologize and Participad.

How to Make (and Keep) New Years Resolutions

A few great ideas on how to make New Year's resolution you might actually keep, and have fun doing so. Whether you like structure or hate it, here are a few approaches and a number of resources to help.

News Wire Stories for December/January

Interesting stories about computer science, software programming, and technology for the month of November 2013.

No computer has ever been designed that is ever aware of what it’s doing; but most of the time, we aren’t either.

The Hungry Camel

How many measures of grain can one camel eat while delivering grain, before the camel runs out of grain to deliver? A fun math problem at least 1,000 years old.

How to Do Online Research

Online research skills are critical for software programmers. It's how you learn any language, by searching for error messages and looking up reference material.


Almost all programming languages include the ability to add comments and other notes in your code. Here's how several languages work with comments.

Take Out the Garbage

In the same way your bedroom may be impossible to enter if you let dirty clothes pile up, computers can crash and refuse to operate if their memory is stuffed with unused data.

bin, boot, opt, and Linux File System Hierarchy Mysteries

The Linux directory structure looks confusing compared to Windows. Here are the names and purpose of each directory.

What is Localhost?

Localhost is available on most computers, usually to display web pages. It's also useful to use to learn coding on your computer.

The Paywall and Adding Voices to Help Kids Code

With this issue, you will find some articles require subscription. Here's an explanation and how you can help add writers and voices to future issues of this magazine.

Learn More Links for December 2013/January 2014

Links from the bottom of all the December 2013/January 2014 articles, collected in one place for you to print, share, or bookmark.

Interested but not ready to subscribe? Sign-up for our free monthly email newsletter with curated site content and a new issue email announcement that we send every two months.

No, thanks!