localhost refers to the computer you are currently using. When you use localhost, it typically resolves to the loopback IP address 127.0.0.1, which is used to access network services running on the same machine.

localhost
localhost resolving to 127.0.0.1

The operating system resolves the hostname localhost to 127.0.0.1 or ::1 through the local hosts file.

To learn more about the hosts file, refer to:

What is a Loopback IP Address

A loopback IP address (such as 127.0.0.1 or ::1) is a special IP address in computer networking that points to the local machine. When a program accesses 127.0.0.1, the data packets do not go through a physical network interface, but are instead looped back directly to the machine's receive queue by the operating system's network protocol stack.