When putting a bike in a box, do I need to take the front and back racks off?
Depends on the bike, the racks, the box, and the reason to do so in the first place.
Seriously, without more information, the question really cannot be answered.
What Duckster said. I could imagine not having to take a rear rack off, but it depends. Probably most front racks would need to come off.
But you’ll almost certainly have to take off the pedals, and if you can do that, the racks are easy in comparison.
I packed my bike once to take on a plane. I had to take off the wheels, pedals (pain in the ass), and handlebars. The rear rack stayed on.
I’ve done the same, and of course, if you have a pedal wrench, it’s actually pretty easy, and in fact, even if it fits in the box with the pedals on, it’s still worth taking them off, as they are very easily damaged.
Don’t know about the racks…as others have said, it depends.
In addition to the other comments, I’ll add this tip: If the wheels have quick release skewers, remove and pack them separately. They stick out and get bent easily if left in the axles. If you have nutted axles, These need some attention to avoid puncturing the carton. New bikes come with pastic caps on these, so you might be able to get some from a bike shop.
In fact, packing a bike for shipping is a service offered by many bike shops. It typically runs $50 or less depending on the shop and the local market. One local shop also rents heavy duty luggage type cases at fairly reasonable rates.