ESP Padding Size Calculator for IPsec VPNs

August 23, 2026

ESP Padding Size Calculator

Calculate IPsec ESP padding, encrypted payload size, tunnel MTU, TCP MSS, NAT-T overhead, and final wire frame size for home lab VPN links.

⚙️Real IPsec ESP presets
📏Packet and tunnel inputs

Packet math stays in bytes; this only changes line-rate length display.

Use for GRE inside ESP, extension headers, or unusual encapsulation.

Optional TFC-style bytes added before ESP alignment padding.

ESP Padding Needed 0 alignment bytes on this packet
Effective Inner MTU 0 largest protected IP packet
Recommended TCP MSS 0 after planning buffer
Wire Frame Size 0 bytes on Ethernet

Formula breakdown

Ready.
🖥️Equipment and protocol comparison grid
4 BAES-GCM alignmentUsually pads ESP trailer to a 32-bit boundary.
16 BAES-CBC alignmentBlock ciphers can add up to 15 bytes of padding.
8 BNAT-T UDP headerCommon when the VPN peer sits behind home NAT.
20 BIPv4 outer headerUsed by many home router IPsec tunnels.
40 BIPv6 outer headerLarger base header, but no IPv4 fragmentation field.
8 BPPPoE reductionOften changes a 1500 path into a 1492 IP MTU.
4 B802.1Q tagRaises wire frame size for trunked firewall links.
2 BESP trailer fieldsPad Length plus Next Header are always present.
📊ESP reference tables
ESP transformAlignmentExplicit IV or nonceIntegrity check value
AES-GCM-128 or AES-GCM-2564 bytes8 bytes16 byte tag
AES-CBC with HMAC-SHA1-9616 bytes16 bytes12 byte truncated ICV
AES-CBC with HMAC-SHA256-12816 bytes16 bytes16 byte truncated ICV
ChaCha20-Poly13054 bytes8 bytes16 byte tag
Null ESP with HMAC-SHA1-964 bytes0 bytes12 byte truncated ICV
ConfigurationTypical added headersPadding behaviorPractical check
Tunnel mode, IPv4 outer20 byte outer IP plus ESPProtects full inner IP packetClamp MSS below calculated inner MTU
Transport mode, IPv4Outer IP remains original IP headerProtects L4 payload sectionUseful for host-to-host or L2TP/IPsec
NAT-T over UDP 45008 byte UDP header before ESPSame ESP padding formulaExpect lower MSS than direct ESP
IPv6 outer tunnel40 byte outer IP headerSame transform alignmentWatch minimum 1280 byte IPv6 paths
Access linkBase MTUCommon ESP resultNotes
Standard Ethernet1500 bytesAbout 1400 to 1438 MSSDepends on cipher, NAT-T, and padding boundary
PPPoE fiber or DSL1492 bytesAbout 1392 to 1430 MSSSubtract PPPoE before IPsec overhead
IPv6 minimum path1280 bytesAbout 1180 to 1218 MSSAvoid assuming 1500 on remote access links
Jumbo lab backbone9000 bytesLarge inner packets possibleEvery hop must support the frame size
Project sizeExample payloadWhat to verifyGood safety margin
Home office VPNTCP web and SSHMSS clamp applies to both peers5% to 10%
Proxmox cluster adminTCP console and APINo fragmentation on management VLAN10%
NAS replication tunnelLarge TCP streamsJumbo or MSS value matches storage path10% to 15%
Mobile IPsec clientMixed UDP and TCPNAT-T and IPv6 path constraints15% to 20%
💡ESP sizing tips
Padding boundary: ESP padding is calculated from the protected payload plus the two ESP trailer fields. AES-CBC usually has the largest swings because the result must land on a 16 byte block boundary.
MTU planning: For tunnel mode, set TCP MSS from the calculated effective inner MTU, then leave a small buffer for real paths with PPPoE, NAT-T, VLAN tags, or IPv6 headers.

A perfect IPsec tunnel configuration was builded. Throughput goes down. Don’t blame encryption. It’s never the bottleneck. Blame packet size.

A data packet gets padded and has headers added until it is too big to fit on network. It either gets dropped or fragment. A typical user think a standard 1500-byte Ethernet frame means they can send 1500 bytes of payload. They can’t. Overhead adds up.

Why Your IPsec Tunnel Is Slow

So here’s how it works: Plug in your access link and tunnel mode constraints. Plug in your cipher. The calculator does the rest, it saves you from making guesses about conversions and coefficients. You want to know why it gives you that TCP MSS value.

So what’s IPsec adding? It doesn’t just add your data. It also adds an outer header, an integrity check, an IV, a sequence number, and an SPI, then it pads it out. That padding isn’t wasted space. That’s part of the requirements of the cipher block.

If you use AES-CBC then your payload need to be 16 byte aligned. That means your payload may require as much as 15 additional bytes of space to fit. If you’re using AES-GCM it’s a bit more flexable. It usually only requires 4 byte alignment. That makes a difference in the effective capacity of your tunnel.

This presents a choice between these ciphers. You are trading off wire efficiency vs. Security properties. On a constrained link such as PPPoE, where your base MTU is already limited down to 1492 bytes, every byte of overhead count. The calculator takes that into account.

You can turn on the PPPoE reduction option to reduce by another 8 bytes. Also NAT-T adds an additional 8 bytes, by wrapping the ESP packet in a UDP header. Another 8 bytes doesn’t seem like much. But it will exceed the MTU limit, and then create fragmentation which kills performance on IPsec. Each fragment has to be decrypted and processed separately.

As you can see in the reference table, various transforms affect the frame size differentally. Header overhead will affect your tunnel more if you’re using IPv6 instead of IPv4. These are IPv4 tunnels. The IPv4 header is only 20 bytes whereas the IPv6 header is 40 byte.

If you have a site-to-site tunnel, that additional weight come right out of your MSS. It doesn’t seem like much but it affects the ratio of overhead to payload which adds up during high volume replication tasks.

But many folks don’t follow the tool’s TCP MSS recommendation. Instead they go with the default setting. Then when they try to download a webpage, their session stalls. Or they open an SSH session but it stutter along.

What does that mean? It means that the MSS (maximum segment size), which is how much data TCP will send per segment, are set too high. Because of the IPsec overhead on top, that makes the overall IP packet too big. It gets dropped on the path.

The tool does some math to determine this: Path MTU minus all those headers outside the ESP (ICV, IV, SPI, padding); then outputs a safe MSS value. Add a little planning buffer onto this value. For links with variable latency (or mobile clients) a 10 percent buffer are wise.

IPsec is about honoring the physical constraints of the wire. Think of it like this: You’re wrapping a present and you need the box to go through the door. There’s only so big the box can be. Either shrink the gift or break the box if you can’t fit it. That’s what the box size tells you based off the calculator.

How do you know how much gift to put in? How fast do you want to go? What trade-off of security vs. Throughput are you willing to make? You should of used that to figure out the right compromise.

Don’t forget to count the padding; it’s part of your limit. Know what the numbers mean, then once they line up, the tunnel will behave as expected. You’ll see the speed you expect without it dissapears strangely. It is a little thing, but it is important.

ESP Padding Size Calculator for IPsec VPNs

Related posts

Leave a Comment