Understanding localhost and 127.0.0.1: Differences, Similarities, and IPv6 ::1
localhost is a local hostname that resolves to the loopback IP address 127.0.0.1, while 127.0.0.1 is the IPv4 loopback address itself; both serve the same purpose, with differences in resolution and configuration, and in IPv6 the equivalent hostname maps to ::1.