Home · Blog · What is ngrok?

What is ngrok? The honest 2026 explainer.

ngrok is a service that gives your local development server a public HTTPS URL. You run one command, and anyone on the internet can hit your laptop. This post explains how it works, what it costs in 2026, when it's the right tool, and when you'd pick an alternative. We compete with ngrok (we make 21tunnel), so we have skin in the game — which means we'll keep this honest. Pure hatchet jobs read as spam.

Published 2026-05-11 · ~10 minute read

TL;DR

ngrok takes a port on your laptop (say localhost:3000) and gives you a public URL like https://abc123.ngrok-free.app that forwards to it. No DNS, no certificates, no firewall config. Free tier lets you run one tunnel with a random subdomain; paid tiers (~$10/mo and up) add reserved domains, custom domains, team features, and more concurrent tunnels. It's been around since 2015, runs on Go, is open-source on the agent side (the server is proprietary SaaS-only). For most developers who just need a public URL for an afternoon, it's the default — and that default is fine. When you'd pick something else: if you need to self-host the entire stack, if you want lower starting prices for paid features, or if you're building for AI coding agents that need delegated API keys.

What is ngrok, actually?

ngrok is a tunneling service. The name covers two things: an open-source agent (a CLI binary called ngrok you run on your machine) and a hosted backend (ngrok's servers, which are not open-source). When you run ngrok http 3000, the agent opens an outbound TLS connection to ngrok's servers, and ngrok hands you a public hostname like abc123.ngrok-free.app. Any HTTPS request to that hostname gets multiplexed over the open connection back to your laptop, where the agent forwards it to port 3000 on localhost.

The clever bit is that this works through firewalls and NAT. Your laptop never accepts an inbound connection — the agent initiates the TLS connection outbound, then everything afterwards rides on that same long-lived socket. So you don't need to forward a port on your home router, fight with corporate IT, or beg DNS for a CNAME. You just run a command.

How ngrok works under the hood

The bones of the system:

What people use ngrok for

The most common use cases — in order of frequency we've observed:

  1. Webhook testing. You're integrating Stripe, GitHub, Twilio, Shopify. They need to POST to a public URL. You don't want to deploy your code every time you change a line. ngrok gives you a URL that forwards to localhost so webhook deliveries hit your debugger.
  2. Sharing a preview. You're a designer or frontend dev showing your work-in-progress to a client or stakeholder. You don't want to deploy to staging just for an afternoon review. ngrok URL → done.
  3. Testing on real mobile devices. Your iPhone can't reach http://localhost:3000. With ngrok, it hits https://abc123.ngrok-free.app instead.
  4. Demos on video calls. Stop screen-sharing, send the URL, let prospects click around themselves.
  5. AI coding agents. Newer use case in 2024-2026 — AI coding tools (Claude Code, Cursor, etc.) increasingly need to expose localhost previews via tunnel so the human can review what the agent built.

ngrok pricing in 2026

ngrok's pricing (as of 2026) has four tiers:

Prices on ngrok's actual pricing page may differ slightly when you read this. The structure has been stable for years; the numbers drift.

ngrok free tier — what's included

The ngrok free tier in 2026:

That's a useful sample of the product but limiting for daily development. The ephemeral-subdomain churn especially — every time you restart your tunnel, Stripe / GitHub / etc need to be reconfigured with the new URL. If you're testing webhooks more than once a week, you'll feel that friction quickly.

Is ngrok safe?

Yes — for development. Three things to know:

For production, ngrok recommends their TCP edge or their Cloud Edge product (paid). The free tier and Personal aren't designed for production traffic — they're development tools.

ngrok alternatives — when to look elsewhere

ngrok is the default for good reason. But there are real scenarios where an alternative is the better pick:

We wrote a longer head-to-head at 21tunnel vs ngrok and a comparison- intent landing at 21tunnel — the open-source ngrok alternative.

ngrok for AI agents

A use case that's grown sharply in 2024-2026: AI coding agents (Claude Code, Cursor, Aider, Devin) increasingly need a public URL to expose what the agent built. The human pastes an API key into the agent's environment, the agent runs a tunnel command, shares the resulting URL back to the human in chat.

ngrok works for this — paste your auth token into NGROK_AUTHTOKEN and the AI agent shells out to ngrok http 3000. The friction shows up at scale: ngrok doesn't have a first-class delegation primitive (no "master key" that can mint short-lived child keys). If you give your AI agent your ngrok auth token, it has all the same permissions you do, indefinitely, until you rotate the token.

For this specific case we built 21tunnel's AI-agent flow: a master key (mtk_master_) that can mint scoped child keys with TTL + quota, organized into project namespaces with subdomain isolation, and one-click cascade revoke. Same shape Stripe / OpenAI / Resend keys use, applied to tunnels.

Should you use ngrok?

If you need a public URL for your laptop's port for an afternoon's webhook debugging and you've never heard of tunneling before — yes, just brew install ngrok, run the command, you'll be productive in five minutes. ngrok is the safe default and being the default is worth something.

Look at alternatives if any of these are true: you want to self-host the entire stack, you want better unit economics on the paid tier, you want open-source server code, or you're building AI-agent workflows that benefit from delegated API keys. For the alternatives we recommend in each case, see the list above.

Disclosure: we build 21tunnel. We try to recommend the right tool for each shape — ngrok itself in the cases where it's the right answer, Cloudflare Tunnel / Pinggy / Localtunnel where those fit better, 21tunnel when our specific tradeoffs (open-source + self-host + AI-agent delegation) match what you're optimising for.


Want to try the open-source alternative? 21tunnel is free on Hobby (3 tunnels, 10 Mbps per tunnel, 20k requests/month, custom domain on signup). Or run the whole thing on your own VM — dual MIT + Apache-2.0.