The most basic medical definition of castration is to remove the testicles from a male human or animal. However, the word may also be used in various extended senses to refer to chemical castration (which renders the testes ineffective in their main function of generating male sex hormones, but without removing them from the body), or to metaphorical castration ("to deprive of virility or spirit; emasculate" — The American Heritage® Dictionary of the English Language, Fourth Edition), or to removing the ovaries from a female. The use of the word "castration" to refer loosely to general genital mutilation (which may or may not include the testicles) is considered incorrect according to formal definitions, but is a common meaning in ordinary non-medical language. A semi-technical term referring to the removal of both testicles and penis is "genital nullification". Someone who has been castrated can be referred to as a castrato, castrate (noun), or eunuch.
In a BDSM context, the castration of testicles and/or penis is a fantasy among some male submissives. However, actual castration is an extreme and permanent bodily modification which has a fairly high likelihood of leading to major legal and/or health problems. It is almost always illegal, except when performed by a certified medical professional.
Safer and less extreme ways of partially satisfying castration fantasies include such practices as erotic sexual denial (orgasm control), the wearing of male chastity belts or devices (such as the Kali's teeth bracelet) or chastity piercings, and/or cuckolding (a male cuckold who helps his female partner adorn herself in preparation for her "date" with another man is acting out one of the traditional roles of a eunuch).
In a legitimate medical context, castration is an integral part of male-to-female sex change surgery.