Make sure you have a plan before you tell them. You will have to find a way to work out that plan with your stbx (even in mediation, if necessary).
From what I have read -- for your children's age -- it is best to tell them 2-3 weeks before Dad moves. Gives them time to process, ask questions, work through initial emotions with Dad still available.
We have a calendar where we write when our girls will be with Dad etc. It REALLY helps them (7 and 5 1/2).
We approached the visitation/overnights gradually.
Books I highly recommend: Helping your children cope with divorce (Not Sandcastles) and The truth about Children and divorce. Both can be found on Amazon.
I strongly recommend doing some reading on the effects of divorce on children and working out a short-term plan with stbx before telling the kids.
We went so far as to work with a child psychologist with an expertise in divorce to help us formulate our parenting plan. We check in with her when we hit a snag, roadblock, etc. Helps to get an expert, objective opinion.