NOT Legal

The batter is not legally in position.
His toes are outside the lines.
As the pitcher delivers the pitch, the batter's feet must be WITHIN the lines. (Rule 6.03)
Legal

Both batters are in a legal position to await a pitch.
They are within the box.
Out of box illegally

This batter's foot is entirely outside the box.
If the bat contacts a pitch at this time, the ball is dead and the batter is out, whether the ball goes fair or foul. All runners return to the bases held at the time of the pitch.
(Rule 6.06a and 5.09d)
Out of box Legal

The heel of these batters' front feet are touching the line.
If the bat contacts the pitch at this time, the batter is not out because his foot is not ENTIRELY outside the box. (Rule 6.06a)
After hitting the ball SAFE

This batter has just hit a fair ball and is starting to run to first.
He is considered to be in the batter's box when
in this position. His back foot is still touching the ground
inside the box.
If he was touched by his batted ball while in
this position, it is ruled a foul ball.

This batter has just hit a fair ball and is starting to run to first.
He is considered to be out of the box when in
this position.
The box is "empty." Neither foot is
touching the lines of the box, or the ground within the box.
If
he is touched by his fair batted ball while in this position, the
ball is dead and he is out.
(Rule 6.05f, 7.08f and 5.09f)