The Terratin Incident

The Terratin Incident is an episode of Star Trek: The Animated Series.

Plot outline
While observing a burnt-out supernova, the U.S.S. Enterprise picks up a strange message transmitted in a two hundred year old code.

The signal is traced to a nearby planet. When the ship enters orbit, it is hit by an energy beam that damages its dilithium crystals and makes the crew begin to shrink (and apparently their clothes have also shrunk because they are organic). The cause is the inhabitants of a miniature city called Terratin. Terratin is a lost Earth colony; its inhabitants have mutated because of the supernova's radiation and are now all microscopic size. Dr. McCoy determines that the crew will continue to shrink beyond their ability to control the ship unless a cure is found.

Kirk beams down to the surface and finds that the transporter can reverse their size. Kirk returns to the ship, but the crew are now microscopic. Meanwhile, the Terratins have beamed the bridge crew down to their city, where the crew learns the Terratins' fate. The crew are beamed back to the ship and return to normal size. However the Terratins have been small for generations and cannot be restored to normal size. Their planet is in peril, so the whole Terratin city is beamed aboard the Enterprise, and moved to another planet.