That's a tricky one to answer. I imagine more than a few have some basis of truth or present a fictionalised version of true events while some are out and out fiction. The best thing I can do is give you a few examples:
Truthful or Based on True Stories - Midway, Dunkirk, Sink The Bismark, Tora Tora Tora, The Dam Busters, Memphis Belle, Das Boot, Battle of the Bulge, The Longest Day, A Bridge Too Far, The Great Escape, Darkest Hour, Merry Christmas Mr Lawrence, The Thin Red Line, Downfall
Fictional - Where Eagles Dare, The Guns of Navarone, Von Ryan's Express, Kelly's Heroes, U-571