In my opinion no age is too young. If they don't understand then it's not going to affect them, and if they do understand then they're old enough to need to say goodbye.
Sometimes children are protected from the real world so much that it prevents them from taking part in the full experience of family life. Shutting them out of something so important is not the answer. Prepare them as much as their ages allow and be there for them through the whole experience, answering any questions and comforting them through any tears.
Allow them to be a fully functioning member of the family, and help them grow into responsible adults, by taking care of them but not overprotecting them.
Death happens in the world and you cannot lie forever. They will lose people and things that matter to them, and it will hurt, but if they know from an early age that it can be dealt with and you do come out the other side eventually. You laugh again, and you can remember without pain after a time. Then they may not find it all quite so frightening a prospect.
Could be a load of bull, but it's what I think.