Documentation

Complete guide to using LocalTunnel for all your development needs. From basic setup to advanced configurations.

Quick Start

Installation

npm install -g localtunnel

Install LocalTunnel globally using npm package manager for system-wide access.

Basic Usage

lt --port 8000

Expose your local server running on port 8000 to the internet instantly.

Installation Options

NPM

npm install -g localtunnel

Global installation via npm package manager - the most common method.

Yarn

yarn global add localtunnel

Global installation via Yarn package manager for Yarn users.

NPX

npx localtunnel --port 8000

Use without installing - perfect for one-time usage or testing.

Docker

docker run --rm -it efrecon/localtunnel --port 8000

Run in a Docker container for isolated environments.

Command Line Options

Option Description Example
--port Specify the local port --port 3000
--subdomain Request a specific subdomain --subdomain myapp
--host Specify the local host --host 127.0.0.1
--local-host Tunnel to different host --local-host staging.local
--open Open tunnel URL in browser --open

Common Examples

Basic Tunnel

lt --port 8000

Create a tunnel to localhost:8000 with a random subdomain.

Custom Subdomain

lt --port 3000 --subdomain myawesomeapp

Request a specific subdomain (requires sponsorship).

Different Local Host

lt --port 8080 --local-host 192.168.1.100

Tunnel to a different machine on your network.

Auto-open Browser

lt --port 3000 --open

Automatically open the tunnel URL in your default browser.

Programming API

Node.js Integration

const localtunnel = require('localtunnel');

(async () => {
  const tunnel = await localtunnel({ port: 3000 });

  // the assigned public url for your tunnel
  // i.e. https://abcdefgjhijk.loca.lt
  tunnel.url;

  tunnel.on('close', () => {
    // tunnels are closed
  });
})();

Troubleshooting

Connection Issues

If you're having connection issues, try using a different port or check your firewall settings.

Subdomain Not Available

Custom subdomains require sponsorship. Consider upgrading your account for this feature.

Rate Limiting

Free accounts have rate limits. If you hit them frequently, consider sponsoring the project.

Need More Help?

Join our community or reach out for support if you need additional assistance.