# localtunnel

> Node.js CLI and API that exposes a local port at a public URL through a tunnel server, for testing webhooks and sharing local work without DNS or deployment.

Stars: 22.5k · Language: JavaScript · License: MIT · Categories: Network

- Repository: https://github.com/localtunnel/localtunnel
- Website: https://localtunnel.me
- Page: https://www.trmn.sh/tools/localtunnel

## Install

- Homebrew: `brew install localtunnel`
- npm: `npm install -g localtunnel`

## Overview

localtunnel is a tunneling tool that exposes a local port to the internet. The `lt` command connects to a tunnel server, sets up the tunnel, and prints a public URL that stays active for the length of the session. You don't need to configure DNS or deploy anything. Typical uses are testing with browser tools such as browserling and receiving callbacks from external services such as twilio, which need a public URL.

The CLI is started with `lt --port 8000`, or with `npx localtunnel --port 8000` without a global install. `--subdomain` requests a named subdomain, and the default is random characters. `--local-host` proxies to a hostname other than localhost. Arguments can also be set through environment variables, for example `PORT=3000 lt`. If you restart your local server, `lt` detects this and reconnects once the server is back.

localtunnel can also be used as a Node.js library. `localtunnel({ port: 3000 })` returns a Promise that resolves once a public URL is assigned, and a callback form is kept for backwards compatibility. Options cover the subdomain request, the upstream proxy `host` (default `https://localtunnel.me`), `local_host` (which also rewrites the Host header), and local HTTPS settings: `local_https`, `local_cert`, `local_key`, `local_ca`, and `allow_invalid_cert`. The returned tunnel object emits `request`, `error`, and `close` events and has a `close` method. This suits test integration and automation scripts.

The README lists clients in other languages: gotunnelme and go-localtunnel for Go, localtunnel-client for C#/.NET, and rlt for Rust. The server component is in the separate localtunnel/server repository. The tool is aimed at web and API developers who need to show or test a local service from outside their network.

### Installation

```bash
# via Homebrew
brew install localtunnel
```

```bash
# via npm
npm install -g localtunnel
```

## Alternatives

- [browsh](https://www.trmn.sh/tools/browsh.md): Text-based web browser backed by headless Firefox, rendering JS-enabled pages to a terminal (TTY) or another browser. Works over SSH or MoSH. (JavaScript, 19.1k stars)
- [magic-wormhole](https://www.trmn.sh/tools/magic-wormhole.md): Python library and `wormhole` CLI for sending files, directories, or text between computers using short, single-use, human-pronounceable codes. (Python, 23.1k stars)
- [hey](https://www.trmn.sh/tools/hey.md): HTTP load testing tool that sends concurrent requests to web applications and reports performance metrics (Go, 20.8k stars)
- [RustScan](https://www.trmn.sh/tools/rustscan.md): Port scanner written in Rust that scans all 65k ports in about 3 seconds and can pipe open ports into Nmap or custom Python, Lua, and Shell scripts. (Rust, 20.8k stars)
- [gallery-dl](https://www.trmn.sh/tools/gallery-dl.md): Cross-platform command-line program that downloads image galleries and collections from many image hosting sites, with configurable file naming. (Python, 20.6k stars)

---

Canonical: https://www.trmn.sh/tools/localtunnel
