Luke's Gospel records that when he was 12 years old he was in the Temple in Jerusalem discussing the Torah with scholars there. Therefore you could estimate he lived in Egypt for no more than 8 years. Most likely a lot less. read more
It seems to me that the most likely scenario is that Jesus was born around 6 B.C., the wise men (by their own account) arrived in Jerusalem two years later in 4 B.C., and in that same year Joseph, Mary, and Jesus fled to Egypt, Herod died, and they returned. read more
The best chronologers have supposed that Herod died somewhere between two and four years after the birth of Christ, but the particular time cannot now be determined; nor can it be ascertained at what age Jesus was taken into Egypt. read more