# internal-ip

> Get your internal IP address

Latest version **9.0.0** (published 2026-02-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install internal-ip
pnpm add internal-ip
yarn add internal-ip
bun add internal-ip
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 9.0.0 |
| Published | 2026-02-02 |
| First published | 2014-09-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=20 |
| Dependencies | 2 |
| Unpacked size | 8.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 352 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | ip, ipv6, ipv4, address, internal, local, machine, system, net, gateway |

## Links

- npm: https://www.npmjs.com/package/internal-ip
- Repository: https://github.com/sindresorhus/internal-ip
- Homepage: https://github.com/sindresorhus/internal-ip#readme
- Issues: https://github.com/sindresorhus/internal-ip/issues
- Funding: https://github.com/sindresorhus/internal-ip?sponsor=1
- npm.io page: https://npm.io/package/internal-ip

## Dependencies (2)

- [is-ip](https://npm.io/package/is-ip.md) ^5.0.1
- [p-event](https://npm.io/package/p-event.md) ^7.1.0

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 9.0.0 (latest) — 2026-02-02
- 8.0.1 — 2025-09-16
- 8.0.0 — 2023-06-10
- 7.0.0 — 2021-10-16
- 6.2.0 — 2020-11-20
- 6.1.0 — 2020-08-04
- 6.0.0 — 2020-03-12
- 5.0.0 — 2019-10-16
- 4.3.0 — 2019-04-05
- 4.2.0 — 2019-02-23
- 4.1.0 — 2019-02-21
- 4.0.0 — 2019-02-16
- 3.0.1 — 2017-10-12
- 3.0.0 — 2017-09-30
- 2.0.3 — 2017-09-16
- … 7 more at https://npm.io/package/internal-ip/versions

## README

# internal-ip

> Get your internal IP address

## Install

```sh
npm install internal-ip
```

## Usage

```js
import {internalIpV6, internalIpV4} from 'internal-ip';

console.log(await internalIpV6());
//=> 'fe80::1'

console.log(await internalIpV4());
//=> '10.0.0.79'
```

## API

The async functions use a UDP connection to determine the address of the internet-facing interface (no packets are sent). When that fails (for example, when offline), it falls back to scanning `os.networkInterfaces()`. The sync functions always use `os.networkInterfaces()`. If multiple non-internal interfaces are present and the internet-facing interface cannot be determined, `undefined` will be returned to avoid selecting the wrong interface.

`internalIpV6Sync()` and `internalIpV4Sync()` are not supported in browsers and just return `undefined`.

### internalIpV6()

Returns the internal IPv6 address asynchronously.

### internalIpV4()

Returns the internal IPv4 address asynchronously.

### internalIpV6Sync()

Returns the internal IPv6 address synchronously.

### internalIpV4Sync()

Returns the internal IPv4 address synchronously.

## Related

- [internal-ip-cli](https://github.com/sindresorhus/internal-ip-cli) - CLI for this package
- [public-ip](https://github.com/sindresorhus/public-ip) - Get your public IP address

---
_Source: https://npm.io/package/internal-ip · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
