Documentation
Complete guide to using LocalTunnel for all your development needs. From basic setup to advanced configurations.
Quick Start
Installation
Install LocalTunnel globally using npm package manager for system-wide access.
Basic Usage
Expose your local server running on port 8000 to the internet instantly.
Installation Options
NPM
Global installation via npm package manager - the most common method.
Yarn
Global installation via Yarn package manager for Yarn users.
NPX
Use without installing - perfect for one-time usage or testing.
Docker
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
Create a tunnel to localhost:8000 with a random subdomain.
Custom Subdomain
Request a specific subdomain (requires sponsorship).
Different Local Host
Tunnel to a different machine on your network.
Auto-open Browser
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.