It would be permissible to wear shorts as long as they cover ones nakedness (`awra), which for a man is the area extending from the navel upto and including the knee. One needs to be cautious though regarding shorts that uncover the knee during movements like walking, bending, and the like.
With that said, when it relates specifically to prayer what is optimal is to wear respectable and dignified dress. Though prayer would be valid in shorts that cover ones nakedness, an individual should realize who one is standing in front of and dress appropriately even if at home.
[Haskafi, Durr al-Mukhtar; Ibn `Abidin, Hashiya]