The perfect length is 22 3/4" from base to tip when installed.
Here's how I know:
I am OCD. I do a lot of work in downtown Houston, and often need to park in parking garages. The OEM antenna was getting the ever-loving-crap beaten out of it in these garages, and I even entered one parking garage where I honestly thought I would hit and crack my sunroof.
So I went to Home Depot and purchased the workings to build the perfect "height-kit" in my own garage. It consisted of: a 5' length of galvanized pipe, foam insulation to fit around the pipe, a long length of para-cord and two screw-in eyelets.
With this I created a pulley system on my garage ceiling with the padded pipe suspended from the ceiling (eyelets) and the cord allowing me to adjust it's height in perfectly minuet increments.
I then pulled the Raptor into the garage noting exactly where the "high point" of the truck was (it's the back of the rear sunroof panel BTW) hitting the padded pipe, and set the pulleys to hold the pipe at that level.
I then backed the truck out and noted where the OEM antenna just touched the height-marker padded pipe, and marked the antenna for cutting - providing a 1.5" - 2" buffer in case of speed bumps or other parking garage irregularities.
I then removed the antenna, and mounted it in my vise (with wooden blocks so not to damage it). Using the claw end of a standard hammer, the ball pops right off the top. I then hacksawed the antenna to the proper length, filed down the top 1/4" to allow for the ball to fit back on, and then JB Welded the ball to the new top. After curing, I then simply gloss spray painted it back black to look original.
After reinstalling this new and improved 22 3/4" antenna on the Raptor, I can confirm that it now touches the suspended padded pipe with about an 1 1/4" overage.
This should be perfect for me now, as it no longer bangs on every garage I enter, and if it does hit on anything, I know to swiftly but carefully back out of that garage as the tolerance is too tight for my comfort level and could lead to a cracked sunroof.
I hope this helps!!
EDIT: Oh and the AM, FM and FM HD reception is still exactly as I noticed prior to cutting the antenna down to this length.