The batter's box is a rectangle drawn on the playing field in which the batter stands to swing at the pitch. There are actually two batter's boxes on the field, one for right-handed batters to the left of home plate, and one for left-handed batters to the right of home plate.
The boxes are rectangles of 4 feet in width and 6 feet in length. They are drawn with chalk six inches to the right and left of home plate, and their center corresponds with the angle at which home plate juts out in a straight line towards the pitcher's mound. Diagram 2 in section 1 of the official rules shows the exact design of the boxes.
A batter must stand inside the batter's box to hit. If his foot steps outside the box in any direction and he makes contact with the ball, he is out. Batters will stand in different areas of the box, according to their preferences and to the pitch they anticipate. Standing forward in the box, towards the pitcher, can help in reaching breaking balls before they break; standing back gives an extra fraction of a second to hit the fastball. Standing towards the inside helps to cover the outside half of the plate, but makes a batter vulnerable to the inside pitch and liable to be hit by pitch. Standing towards the outside edge helps with inside pitches, but makes the batter vulnerable to pitches on the outside corner of the plate.
A batted ball that hits the batter while he is still in the batter's box is a foul ball. If it hits him after he has left the box, he is automatically out if the ball is in fair territory (it is a foul ball otherwise). A batter can step out of the batter's box only at certain times, and must ask the umpire to call time for him to do so. These rules are covered in section 6 of the official rules.