Skip to main content

ngrok vs. Cloudflare Tunnel

When is ngrok a Cloudflare Tunnel alternative?

Unlike most tools that get compared to ngrok, Cloudflare Tunnel really is an architectural cousin. It was introduced in 2021, 8 years after ngrok. Both run a lightweight agent that connects outbound from wherever your service lives, so nothing inbound ever touches your firewall.

Here's the major difference:

Cloudflare Tunnel is an on-ramp into Cloudflare's platform. The cloudflared connector publishes your service as a hostname in a domain whose DNS lives on Cloudflare, and everything else (authentication via Access, transformation via Workers, private networks via WARP) is assembled from the rest of the Cloudflare suite. It's zone-centric: the unit of everything is your Cloudflare account and domain.

ngrok is a self-contained and platform agnostic secure tunnel. An agent (or SDK, or Kubernetes operator) makes the same kind of outbound connection, and your service becomes a URL with authentication, traffic policy, and observability built into the same tool, on any domain, with no DNS migration. It's service-centric: the unit of everything is the endpoint.

That difference (bring your domain to the platform versus give this one service a URL) decides every use case below.

Use caseVerdict
Customer connectivity (your SaaS product reaching into customer networks)
ngrok
General tunneling & sharing localhost
ngrok
Remote access to device fleets you ship or manage
ngrok
Zero-trust access for your own team and devices
Cloudflare
Homelab
Depends:
web on a Cloudflare domain → Tunnel
everything else → ngrok
Mesh networking / VPN replacement
Neither — use Tailscale
Gaming
Mostly ngrok
AI Gateway
Depends

Customer connectivity: connecting your SaaS product to customer networks

This situation can make zone-centric design a problem, because the networks involved belong to your customers, not to you.

Say you sell SaaS software that has to reach systems inside your customers' networks: an integration that queries an on-prem database, an AI agent that acts on a customer's internal systems, a SaaS product that syncs with a warehouse behind a firewall. Their security team will ask two questions: "what exactly can you reach?" and "how do we turn it off?"

Run cloudflared inside a customer's network, but everything about that tunnel lives in your Cloudflare account: the tunnel, its hostname in your zone, the Access policies in front of it. There's no primitive for "this credential belongs to customer A, is scoped to exactly one service in their network, and can be revoked without touching customer B." You end up hand-assembling per-customer isolation from separate tunnels and service tokens, and the customer's security team gets no clean answer to either of their questions.

ngrok treats multi-tenancy as the base case. The customer (or your installer) runs a lightweight agent next to the one service you need (postgres.customer-acme.internal, not a network route), and each customer gets their own credentials and policies: isolation is structural, and revoking one customer's access is deleting one credential. This is the use case ngrok's customer connectivity product is built around, and it's how customers like Databricks reach into networks they don't control.

Verdict: ngrok. Cloudflare Tunnel is built to connect your infrastructure to your zone. When the infrastructure belongs to a thousand different customers, you need per-customer isolation as a primitive, not a construction project.

General tunneling: webhooks, demos, and sharing localhost

The original ngrok use case: you're running something on localhost:3000 and someone (or something) outside your machine needs to reach it.

Credit where due: Cloudflare's quick tunnels are a fine and free way to get a throwaway URL. One command, a random trycloudflare.com address, no account needed. If that's all you need, it works. But a stable hostname requires a named tunnel, and a named tunnel requires your domain's authoritative DNS to live on Cloudflare, plus the tunnel-UUID, credentials-file, and DNS-routing choreography our migration guide walks through. That's a lot of clickops for "let Stripe reach my laptop."

Webhook work is receive, inspect, fix, replay: you need to see exactly what the provider sent and re-send the same request without re-triggering it upstream. ngrok's inspection and replay exist for precisely that loop; Cloudflare Tunnel delivers the traffic and tells you nothing about it. Add a free static domain on every account, custom domains without moving DNS, and Traffic Policy when you want auth or rate limits in front, and the URL is one command with the debugging built in.

For teams, the same issue is with control: the front-door pattern gives platform teams one place to govern which endpoints touch the public internet and which policies apply. On Cloudflare, assembling the equivalent typically means stitching together Tunnels, Access, and Workers.

Verdict: ngrok. Quick Cloudflare tunnels are fine for a one-off share. When it becomes an automated workflow (webhooks, demos, OAuth redirects) needing inspection, replay, and stable URLs without a DNS migration, you should choose ngrok, as this is the core product.

Remote access: your team versus your fleet

Your own team and devices: use Cloudflare. Zero-trust access for employees (reaching internal apps, SSH to your own servers, browser-rendered terminals, device posture checks) is what Cloudflare Access and WARP are actually for, it's a mature product, and it's free for up to 50 users. If the problem is "my company's people need to reach my company's internal things," Cloudflare's ZTNA story is genuinely good and we're not going to pretend otherwise.

Devices you ship or manage in other people's networks: use ngrok. Kiosks in stores, POS terminals, medical devices in clinics, industrial controllers on factory floors. The devices sit in networks you don't own, so the your-account-your-zone model turns every device into account plumbing. What you actually need is what a device gateway provides: a lightweight agent dialing out through CGNAT and hostile firewalls, one named endpoint per device, per-device credentials you can revoke individually, and an API to automate all of it across ten thousand units. It's the customer connectivity model again, with hardware.

Verdict: split. Your team reaching your internal systems → Cloudflare. Fleets deployed in networks you don't own → ngrok.

Homelab

If your domain already lives on Cloudflare and what you're exposing is a web app, Cloudflare Tunnel is a hard combination to argue with: always-on, free, no port forwarding, Access in front if you want a login page.

The "everything else" column is longer than it looks, though. Anything TCP that friends connect to directly (a game server, a database, SSH for a collaborator) needs cloudflared or WARP installed on their machines; an ngrok TCP endpoint is just an address you paste. Media is its own caution: Cloudflare's terms have historically restricted serving heavy non-HTML content like video through the free tier, which is worth reading before you put Plex behind it. And when something breaks, ngrok's request inspection shows you what actually hit your service. ngrok gives that one service a stable URL on your own domain (no nameserver migration) with basic auth or OAuth in front so "public URL" doesn't mean "open to the internet."

Verdict: depends. Web services on a domain you already run through Cloudflare → Tunnel. TCP, media, anything you need to debug, or a domain you don't want to move → ngrok.

Mesh networking: connecting all your devices and your team

Shortest section on the page, because the honest answer is: neither. ngrok has no device-to-device connectivity at all. Cloudflare can route you into private networks, but every packet goes client → Cloudflare → network; there's no peer-to-peer path between your devices. If what you want is a mesh (every device on a shared private network, direct WireGuard connections, LAN emulation), use Tailscale. We compare against it honestly in ngrok vs. Tailscale, where it wins this section too.

Verdict: neither. Use Tailscale.

Gaming

The test case is a Minecraft Java server (TCP) for people who will not install networking software: your kid's friends, your Discord group, strangers.

An ngrok TCP endpoint produces an address anyone pastes into their client: no software installed, no port forwarding, works behind CGNAT. Cloudflare Tunnel can carry the same TCP traffic, but every player would need cloudflared or WARP running on their machine to connect, which is a non-starter for exactly the audience a game server has.

For UDP games, voice chat, and virtual LAN parties, neither tool is the answer: ngrok doesn't do UDP, and Cloudflare's UDP routing assumes WARP enrollment in your Zero Trust org, which is not how anyone runs a LAN party. That's Tailscale territory again; see ngrok vs. Tailscale.

Verdict: mostly ngrok. TCP game servers shared with people who won't install anything → ngrok. UDP and LAN emulation → Tailscale, not Cloudflare Tunnel.

AI Gateway

Cloudflare AI Gateway is a strong outbound control plane for LLM calls: response caching, rate limits, spend limits, automatic fallbacks and dynamic routing across providers, guardrails, bring-your-own-key credential storage, and unified billing that puts provider usage on your Cloudflare invoice. If your apps already run on Workers and your problem is my code calls models and I need to cache, meter, and observe that, it's a genuinely good answer and priced to be adopted.

The ngrok AI Gateway covers the same outbound job (provider keys attached to gateway keys, multi-provider routing through one endpoint, metering and rate limits via the same Traffic Policy engine), but it's half of a connectivity story rather than a caching layer. The other half is inbound: agents and MCP servers are services that need to be reachable (by other agents, by webhook-driven platforms, by your customers) with authentication and observability in front. And the agents that matter commercially often need to act inside customer networks, which is the customer connectivity section again. Cloudflare's AI Gateway doesn't address either side of that; it sits between your code and the model providers, full stop.

Verdict: depends on direction. Optimizing outbound LLM calls, especially on the Cloudflare stack → Cloudflare AI Gateway is credible. Building agents and MCP servers that must be reachable, or that act in your customers' networks → ngrok.

The free question

Cloudflare Tunnel is free, and not free-with-an-asterisk: for web services on a domain you run through Cloudflare, there is no bill. If price is the whole decision, we're not going to win it with this paragraph, and pretending otherwise would insult your intelligence.

What's worth pricing is everything around the tunnel. Free assumes your domain's authoritative DNS moves to Cloudflare. TCP costs client software on every visitor's machine. Debugging costs a tool you don't have, because there's no request inspection or replay. Serving heavy media has historically been constrained by Cloudflare's terms. And policy beyond a login page means building on Workers, which is engineering time. ngrok's free tier includes a static domain and the full development workflow; paid plans price the production capabilities (custom domains, Traffic Policy at scale, bound endpoints) that on Cloudflare you'd assemble from three products or can't assemble at all.

The honest summary: if Tunnel's free tier covers your use case end to end, use it. The sections above are about the use cases where it doesn't.

ngrok vs. Cloudflare Tunnel at a glance

The spec-sheet view of everything above. Rows where the answer is "no" aren't gaps so much as consequences of each architecture.

FeaturengrokCloudflare Tunnel
What it isSecure tunnels to named servicesFree tunnel connector into Cloudflare's platform
Unit of accessA service endpoint, governed by policyA hostname in your Cloudflare zone
Works without moving your DNSYes — free ngrok domains, or any custom domain via CNAMENo — named tunnels require Cloudflare nameservers (quick tunnels excepted)
Visitors must install a clientNo, for HTTP and TCP alikeNo for HTTP; yes for TCP and UDP (cloudflared or WARP)
Public TCP addressesYesNo — TCP requires client-side software
Traffic inspection & replayYes, built inNo
Auth in front of a serviceOAuth, OIDC, SAML, mTLS, IP restrictions, JWTs — one toolCloudflare Access (separate product, free ≤50 users)
Traffic transformationTraffic Policy: a few lines of YAML at the edgeWorkers: code you write and deploy
Multi-tenant customer connectivityBound endpoints with per-customer credentialsDIY from separate tunnels and service tokens
Kubernetesngrok Kubernetes Operator (Gateway API, Ingress)Run cloudflared as a Deployment
Zero-trust employee accessEndpoint policies per serviceWARP + Access — a mature ZTNA suite
AI Gatewayngrok AI Gateway (inbound and outbound)Cloudflare AI Gateway (outbound control plane)
PricingFreemium — free static domain, paid production featuresFree with a Cloudflare account and zone

Which one should you choose?

The two products disagree about what the center of gravity is. For Cloudflare Tunnel it's the platform: your domain joins Cloudflare, and each capability (auth, transformation, private access) is another Cloudflare product attached to your zone. For ngrok it's the service: an endpoint gets a URL, and policy, auth, and observability travel with it. Neither is universally right.

Choose Cloudflare Tunnel when you're already committed to Cloudflare (your DNS is there, your team knows Access and Workers) and what you're exposing is your own web services. The price is unbeatable and the platform is real.

Choose ngrok when the connectivity itself is the product: webhook development you need to inspect and replay, TCP services reachable by people who won't install software, device fleets and customer networks you don't own, agents that must be reachable from the outside. That's when a self-contained, policy-controlled endpoint beats a platform on-ramp.

And as with every comparison we write: plenty of teams run both. Domain on Cloudflare, ngrok endpoint on a CNAME. They stack fine.

Frequently asked questions

Skip the DNS migration.
Reach one named thing.

No upfront costs. One command to a secure, policy-controlled URL.