My advice is NOT to say anything until you have clear plans about how their care will be managed, where they’ll be living, schools, custody switches etc
if you tell them that you’re splitting without being to answer these obvious questions they’ll be thinking, they’ll fill that hole of unknown with fear and anxiety. Remember they aren’t in control of where they live or conduct their lives - you’re both the parents so you need to sort this out first, even if you don’t have details down to last bit, and tell them this at same time
make sure you both tell them togther. Tell them you’ll continue to parent them together, tell them it is a decision between you and spouse and not anything to do with them
agree and rehearse, if needs be, your joint reason you’ll give to kids. Even with mine at age 25 and 28, we simply said that we’d agreed it was better for us to live apart . That sort of level is all that’s needed. They’ll ask more with time and age,and you can answer better then once the initial pain and grief has eased
above all, remember this will put them on a grief pathway. Read up about it. They are experiencing a loss, as are both you and stbex, everyone needs time to deal emotionally with that. The Grief pathway is a useful tool to understand the natural feelings and emotions that result from this sort of loss. You knowing this can help you deal appropriately with the kids emotions over next months and years.
your kids will come to terms with it, they will adapt, but it is easier if both parents remain united in their parenting approach and give consistent messages to kids. Sit with your stbex and work through the details first, then what message you’re going to give to them.