Do not measure your pet directly for width!
1. Open a door as wide as they need to comfortably walk through.
2. Use a treat for motivation.
3. Measure that width.
You need the flap to be at least that wide. It doesn't need to be wider. Realize that the top of the flap should be mounted at least one inch over the dog's height at the top of his/her shoulder (the withers).
In no case should the "step-over" (the distance between the ground and the bottom of the flap) exceed 1/3 of the height at the withers - the lower the "step-over", the better.
Pay special attention if your dog has a particularly deep chest or is low slung and adjust accordingly.
If you have a larger/taller dog sharing a pet door with a smaller dog or would just like to have a taller pet door:
On the far right of the image above is a pet door with a "high aspect ratio".
This kind of pet door would be the Endura Flap.
So what is the point of all this?
We are trying to make the pet door as 'accessible' as possible for your pet.
Here's why. There can be a time when your pet won't be able to use his pet door. Maybe he's got hip problems or an injury. Maybe he's just old and can't move very well. All these years he's been going outside to do his 'business' and now he can't anymore. But he's still alive and he's still your 'baby'.
The point here is we want this time to be as far away as possible. And that means you want to buy a pet door that will be easy to use - not so much now, but when he's old and not so agile.
So what is properly sized pet door? Well, the top of the opening is at or above his withers so he doesn't have to crouch. The width is as wide as he is or a little wider. And the 'step-over' is as low as possible while still keeping the top of the opening up at or above his withers.
This is what 'high-aspect ratio' pet doors are all about. For a given width, you get more height which actually means you can get the step-over lower to the ground for easier access later in life.
Of course, it all depends on the situation. Maybe he's a youngster and you're going to move to a new place soon. In that case, mount the pet door at the correct height (at or above his withers). He'll be able to use a higher 'step-over' until you move, and you can easily get a properly sized pet door at your next house.