How to get Networked Computer Name from IP Address on a LAN
Mar 13, 2015WindowsComments (35)
If you have the local IP address of a computer on your network, and need to get that computer's name, there is an easy method using the ping command in a Windows command prompt.

Command Prompt
Open up a command prompt by typing "cmd" into the start menu search (Windows Vista, 7, or newer) or by opening a Run window and then running "cmd" (Windows XP).

How To Open Windows 7 Command Prompt

Use the following command to ping the local IP address (change to the IP address you want to ping):

ping -a
The -a option of the ping command tells it to resolve the hostname of the IP address, so it will give you the name of the networked computer.

Here is an example of the output for a hypothetical computer named "Office1" that is at local IP address

C:\Users\Username>ping -a

Pinging Office1 [] with 32 bytes of data:
Reply from bytes=32 time<1ms TTL=128
Reply from bytes=32 time<1ms TTL=128
Reply from bytes=32 time<1ms TTL=128
Reply from bytes=32 time<1ms TTL=128

Ping statistics for
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

Full Network Discovery

If you need to get the hostnames and other information for all of the PCs on your network, I recommend using Advanced IP Scanner.
Comments (35)
Add a Comment
TruthBeTold   Feb 04, 2022
The correct command is nbstat Type "nbtstat -a <ip_address>". Note that <ip_address> is the IP address of the computer.
Erik   Dec 03, 2021
Work great! :))
Gilbert   Nov 27, 2021
This command helped me to get the machine name ping -a <IP> works excellent
M.Hamidi   Jun 27, 2021
Fireblaster   Mar 09, 2021
Hate to comment on a post so old, but you may find nslookup to be what you need. Caveat: a DNS server must exist on the network. In a command prompt enter : nslookup (whatever IP address you want) The response if successful: Name: machine name Address:
Turf   Feb 26, 2021
for some of these and you know DNS is there you could use nslookup instead and get more info from
John   Nov 30, 2020
I am trying this on a domain server and it returns the IP address of whatever I ping, not the computer name. Maybe I am missing something. This is server 2016 and just noticed @gmms comment. Interesting John
gmm   Jul 27, 2020
server 2016 standard only returned the IP address. what if the host-name in the firewall reads "none" does that mean it is being masked, or there just isn't one?
venkatesh   Feb 26, 2020
This command helped me to get the machine name ping -a
Anonymous IT Person   Feb 12, 2020
This is fantastic! Helped me immensely! Many thx!!
Dominique   Feb 04, 2020
Thanks godbless dude
jinner   Dec 26, 2019
Thank you very useful.
Ryan   Oct 08, 2019
Thanks! This solution worked for me!
Mbiko Ngoma   Jul 17, 2019
This worked for me on windows 10 which is connected to a domain thanks a lot
eli   Jul 15, 2019
doesnt work in windows 10
Hulk Hogan Batista (Fareportal)   May 01, 2019
This is great! I love you guys for helping me. I did not know how to ping or do any of this stuff. I am learning on the field and the ping command is cool. I built a mexico office with my old computers and proud of it. I love you daddy Diane Huff!
Paul   Jan 31, 2019
This is great expecially when the DNS cache is out of date. For example today I could not remote into a destination hostname so I used 'ping Office1' which returned an unexpected IP Address then with your help I was able to use ping -a to find a that this is actually a different host 'Office2'. Thg
Stephen   Oct 17, 2018
This command worked for me on Windows 7. Oddly nbtstat -a didn't.
Andrie   Aug 08, 2018
Thank you very useful!
That Guy   Aug 03, 2018
Command does not always work for some devices or on some versions of Windows. Use the following instead, replacing the listed IP with the IP you need to look up: nbtstat -a
kadettilac   Jun 14, 2018
Awesome, thanks
Hedy   May 26, 2018
Tushar more   Apr 30, 2018
Pavan Amaze   Mar 15, 2018
Not Good Answer..
Ritch   Mar 07, 2018
Mavado   Mar 07, 2018
Thanks worked like a charm
Sentpaoul   Feb 04, 2018
thanks buddy its work
Mo   Dec 29, 2017
Thank you
Rory Kelleher   Jul 03, 2017
Nice one
Andile Solution-Provider Simelane   Jun 06, 2017
That usually when the IP is using Linux OS
Greg Miller   Apr 19, 2017
David Fenton   Mar 30, 2017
Sasha Bond   Jan 31, 2017
does not work, replies with IP only
Muhammad Tahir Khan   Jan 08, 2017
Thanks for command and advice Advanced IP Scanner
Jazmin Aych   Jan 14, 2016
Thank you immensly!