How long does it take to get from the centre of Paris to Versailles by RER.

I am planning to stay in Versailles for 3 nights and travel into Paris, however I am a family of 6 (incl 4 children) and am wondering how to find the cheapest alternative.