A nanite is built by manipulating atoms and contains gigabytes of computer memory. It is small enough to enter living cells and can be programmed to do numerous tasks. Nanites are used by the Federation for medical purposes and are designed to work inside nucleii during cellular surgery. When they are not used, nanites are stored in a non-functional state. When necessary nanites can be destroyed with a burst of high-level gamma radiation.
Nanites consist of several components with different functions. Nanites used in the 24th century are composed of a forward propulsion block, an Oneamisu receiver, a Ranma ½ gyro block, a hex growth stack, Otomo calibration, two reverse flow paddles, one cell membrane sensor and manipulator each, a telemetry antenna, a forward motion sensor, a crystal articulator, logic circuits arranged from A-F and G-L, a T-cell antireceptor and an emergency dissolve system.
In 2366 Wesley Crusher experimented with nanites aboard the USS Enterprise-D to see if he could enhance their capabilities, by letting them work together. When these nanites escaped they entered the Enterprise computer core where they multiplied and interfered with almost all ship operations. Their increasing numbers allowed them to develop collective intelligence. When Doctor Paul Stubbs tried to kill them in order to prevent interference with his scientific experiments, the nanites retaliated by taking over control of the Enterprise life support systems and even tried to kill him. The targeted nature of these actions became proof of sentience and they became perceived as lifeforms. The destruction of the Enterprise was prevented by Data who was able to talk to the nanites and as their spokesman was able to come to an agreement with Captain Jean-Luc Picard. The enhanced nanites repaired the damage to the ship's computers and were then transfered to Kavis Alpha IV, where they founded their own civilization. (TNG: "Evolution")
Doctor Beverly Crusher suggested to use nanites as a weapon against the Borg during their incursion into the Federation in late 2366. The plan however was not implemented, as the process of preparing the nanites would have taken several weeks. By then the Federation may only have existed as part of the Borg Collective. (TNG: "The Best of Both Worlds, Part II")
The plan to use nanites against the Borg is mentioned in the novel Vendetta, where it is revealed that the nanites are now legally protected as their apparent sentience caused many to argue that using them against the Borg as a weapon would be violating their rights, La Forge accepting the argument when Data points out that it is essentially the same as having him dismantled and copied simply to create new versions of him to fight the Borg.