> For the complete documentation index, see [llms.txt](https://til.devjugal.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://til.devjugal.com/python/get-ip-address-from-hostname.md).

# Get IP Address From Hostname

In Python, we can get IP Address for a hostname by using `gethostbyname` function from `socket` module, which is in built in Python.

## Example

```python
>>> import socket
>>> socket.gethostbyname("www.google.com")
'172.217.166.4'
```

***Source:*** [***Simplified Guide***](https://www.simplified.guide/python/hostname-to-ip)
