Don't be surprised if they already know. In the case of a separation, the children should be told at or about the time it occurs. The key is honesty. Don't hold out false hopes that the marital relationship will continue if it's obvious it will not. Don't blame your spouse for everything, and make it clear that the separation is in no way the children's fault.
Children frequently blame themselves for their parents' marital problems.
Don't hesitate to get advice from a therapist. Take advantage of the guidance available for you and your children during a time when you both may need it. Keep the explanation simple and straightforward. Have both parents tell their children at the same time to avoid looking as if one parent is responsible. Don't dramatize or become sentimental.