Skip to main content
Fully client-side · WireGuard · OpenVPN · IPsec · GRE · VXLAN

MTU & MSS calculator.

Choose your physical link and tunnel stack. Get the exact interface MTU, the TCP MSS to clamp to, the largest ping that must pass, and config you can paste. Nothing leaves your browser.

Recommended interface MTU
1440
bytes
Safe TCP MSS
1400 IPv4 · 1380 IPv6
MTU - 40 / MTU - 60
Largest unfragmented ping payload
1412 IPv4 · 1392 IPv6
MTU - 28 / MTU - 48
Encapsulation overhead
60
bytes on a 1500-byte link

Byte-by-byte overhead

Outer IPv4 header20
UDP header8
WireGuard data header + Poly1305 tag32
1500 - 60 = path MTU inside the tunnel1440

Type/reserved 4, receiver index 4, counter 8, ChaCha20-Poly1305 tag 16. Payloads are padded to a multiple of 16 bytes but never beyond the interface MTU.

Verify with a Don't-Fragment ping

Should succeed (1412 + 28 = 1440 bytes on the wire)
ping -M do -s 1412 -c 3 1.1.1.1
Should fail with “message too long” or no reply (1413 bytes)
ping -M do -s 1413 -c 3 1.1.1.1

Run these from a host whose traffic goes through the tunnel. If the first one fails, lower the MTU until it passes; if the second one also passes, your MTU is lower than it needs to be.

Ready-to-paste config

WireGuard (/etc/wireguard/wg0.conf)
[Interface]
MTU = 1440
iptables MSS clamp
iptables -t mangle -A FORWARD -o wg0 -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1400
iptables -t mangle -A FORWARD -i wg0 -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1400
nftables MSS clamp
table inet mss_clamp {
  chain forward {
    type filter hook forward priority mangle; policy accept;
    oifname "wg0" tcp flags syn tcp option maxseg size set 1400
    iifname "wg0" tcp flags syn tcp option maxseg size set 1400
  }
}

The clamp uses the IPv4 MSS (1400). It leaves IPv6 TCP a 20-byte margin, which is harmless; use 1380 in a separate ip6tables rule if you want it exact.

What this tool does

Every network link has a maximum packet size, the MTU (maximum transmission unit). Ordinary Ethernet carries 1500 bytes of IP packet. A VPN or overlay tunnel wraps each packet inside another packet, so the wrapped version is larger than the original. If the tunnel interface still advertises 1500 bytes, full-size packets produced by applications no longer fit once they are wrapped, and something has to give. This calculator subtracts the exact overhead of your tunnel stack from the physical link MTU and tells you the largest packet the tunnel interface can accept, the TCP segment size that matches it, and the biggest ping you should be able to send. It then gives you the commands to prove those numbers on your own network instead of trusting a formula.

Where the overhead comes from

The byte counts in the table are defined by the protocols themselves. Starting from the physical link MTU, each tunnel layer takes a fixed bite:

  • Outer IP header — 20 bytes for IPv4, 40 for IPv6. The family of the underlay matters, not the family of the traffic inside.
  • UDP header — 8 bytes, used by WireGuard, OpenVPN over UDP, VXLAN and IPsec NAT traversal.
  • WireGuard — a 16-byte data header (type, receiver index and counter) plus a 16-byte Poly1305 authentication tag, 32 in total. With UDP and IPv4 that is 60 bytes, and 80 over IPv6.
  • GRE — 4 bytes for the base header, 4 more for each of the optional key and sequence fields.
  • VXLAN — an 8-byte VXLAN header and the inner Ethernet header of 14 bytes carried inside the payload, 50 bytes with the outer IPv4 and UDP headers.
  • IPsec ESP — an 8-byte ESP header, an explicit IV, 0 to 3 bytes of padding (more with block ciphers), a 2-byte trailer and an integrity check value. The total depends on the cipher, so the tool models AES-GCM with worst-case padding and marks the result as an estimate.
  • OpenVPN — an opcode and peer ID, a packet ID and an authentication tag with AES-GCM, but 20 to 40 more bytes with older CBC and HMAC configurations.

Subtract the sum from the link MTU and you have the path MTU inside the tunnel. For WireGuard over IPv4 on plain Ethernet that is 1500 − 60 = 1440. The famous default of 1420 used by wg-quick comes from budgeting for the larger IPv6 overhead, so one number works whichever family carries the tunnel. Tailscale makes a different choice: it fixes tailscale0 at 1280, the smallest MTU an IPv6 network may use, so it works everywhere at the cost of a few percent of throughput.

Why a wrong MTU breaks things in confusing ways

An MTU that is too large does not produce a clean error. Small packets, such as DNS lookups, pings and the start of a TCP handshake, pass. Large ones, such as a TLS certificate, a file download or an SSH session that prints a long directory listing, stall. The classic symptom is a connection that opens and then hangs, or a website that loads its text but never its images. The reason lies in how the Internet handles oversize packets.

IPv4 senders usually set the Don't-Fragment bit. When a router meets a packet that does not fit the next link, it drops the packet and returns an ICMP message of type 3, code 4, “fragmentation needed and DF set”, containing the MTU it can accept. The sender lowers its packet size and retries. This is path MTU discovery (PMTUD). IPv6 works the same way with the ICMPv6 “Packet Too Big” message, and since IPv6 routers never fragment, it is mandatory. If any firewall on the path drops those ICMP messages, which is a common result of the well-meaning rule “block all ICMP”, the sender never hears about the problem and keeps sending packets that are silently discarded. That condition is a PMTUD black hole.

The fix is not to open the firewall to everything, but to allow ICMP type 3 code 4 and ICMPv6 type 2, and to stop depending on PMTUD at the tunnel itself.

MTU, MSS and the ping payload are three different numbers

The tool reports three figures from the same input because each is used in a different place:

  • Interface MTU is what you configure on the tunnel device, for example MTU = 1420 in a WireGuard config. It limits the whole IP packet.
  • TCP MSS is the largest TCP payload in one segment. It is the MTU less 20 bytes of IP and 20 of TCP header on IPv4, or 40 + 20 on IPv6, so it is MTU − 40 or MTU − 60. Hosts agree on it during the handshake, which is why clamping it fixes TCP even when ICMP is broken.
  • Ping payload is the data after the 8-byte ICMP header, so it is MTU − 28 on IPv4 and MTU − 48 on IPv6. The number you pass to ping -s is the payload, not the packet size, which is a frequent source of off-by-28 mistakes.

Test it: the Don't-Fragment ping

Never trust a calculated MTU on a real network without measuring it, because carriers and cloud networks quietly impose their own limits. The measurement is simple: send a ping of a known size with the Don't-Fragment bit set, from a machine whose traffic crosses the tunnel. If it returns, the path carries that size. If it fails with “message too long” or “Packet needs to be fragmented but DF set”, the path is smaller. The calculator prints two commands for your operating system: one at the recommended size that should succeed, and one byte larger that should fail. If both succeed, your MTU is lower than it needs to be, which costs a little throughput but does no harm.

  • Linux: ping -M do -s 1412 1.1.1.1
  • macOS: ping -D -s 1412 1.1.1.1
  • Windows: ping -f -l 1412 1.1.1.1

The sizes above are an example for a 1440-byte path. Use the values the calculator shows for your own stack. Windows also accepts -n for the count where Linux and macOS use -c, which the tool takes care of in the commands it generates.

MSS clamping: the belt-and-braces fix

Lowering the MTU on one end is not always enough, because the other side may still advertise a large MSS for a path it does not know about. A router or VPN gateway can fix this by rewriting the MSS option on TCP SYN packets as they pass through, so both ends agree on a segment size that fits. This works even when ICMP is filtered, since it does not rely on PMTUD at all. The tool outputs ready-made rules for the two common Linux firewalls, using the IPv4 MSS for the interface name you enter. The iptables rules use the TCPMSS target in the mangle table and set the value explicitly, and the nftables version does the same through a tcp option maxseg size set expression. Both apply in each direction on the tunnel interface. Only SYN packets are touched, so the overhead on the router is negligible. UDP traffic such as QUIC and DNS cannot be clamped; it relies on the interface MTU and on endpoints that probe their own path.

Common situations and what to check

  • Home WireGuard behind PPPoE. Fibre and DSL often use PPPoE, which takes 8 bytes and leaves 1492. A tunnel MTU of 1420 still works because it was budgeted for IPv6, but the exact figure is 1432 over IPv4.
  • Mobile networks. Cellular carriers often use a smaller or variable MTU and sometimes add their own tunnel inside the network. Measure rather than assume, and expect different results per carrier.
  • Docker, Kubernetes and nested overlays. Each layer subtracts its own overhead. A pod network on VXLAN, running on a VM whose NIC is already behind a cloud overlay, can have an effective MTU well under 1400. Set the container network MTU to the smallest value in the chain.
  • Jumbo frames in data centres. With a 9000-byte underlay a VXLAN or WireGuard tunnel can carry nearly 9000 bytes, but only if every switch and NIC on the path is configured for it. One 1500-byte hop turns jumbo frames back into a PMTUD problem.
  • IPv6 below 1280. An IPv6 interface cannot work below 1280 bytes. If the calculation falls under that, the tool warns you, because IPv6 through that tunnel will fail until you raise the link MTU or choose a lighter stack.

Frequently asked questions

What MTU should I use for WireGuard?

WireGuard adds 60 bytes over IPv4 and 80 over IPv6, so a 1500-byte link gives 1440 or 1420. The wg-quick default of 1420 is safe for both families. On PPPoE (1492) the equivalents are 1432 and 1412.

Why do pings work but HTTPS pages hang over my VPN?

Small packets fit but full-size TCP segments do not, and the ICMP messages that should warn the sender are being dropped somewhere. Lower the tunnel MTU or clamp the TCP MSS.

How do I calculate TCP MSS from MTU?

Subtract 40 bytes on IPv4 or 60 on IPv6, which covers the IP and TCP headers when there are no options. A 1420-byte tunnel gives an IPv4 MSS of 1380.

What is the largest ping I can send without fragmenting?

MTU minus 28 on IPv4, so 1472 on a 1500-byte link, sent with the Don't-Fragment bit set.

Related tools and guides

Once the tunnel is stable, confirm it is not leaking with the DNS leak test and the WebRTC leak test, check your exit address on the home page, and read the guide to what a VPN actually does. Behind carrier-grade NAT and unable to accept inbound connections for your own tunnel endpoint? See the CGNAT explainer. Planning the address space for a site to site link? Try the subnet splitter.