A safeword is a codeword or series of codewords that are sometimes used in BDSM to mean that a bottom or submissive is reaching a limit or for the Top/Dom to stop the sceneplay. Safewords are agreed on by all participants before playing a scene. Many organised BDSM groups have standard safewords that all members agree to use to avoid confusion at organised play events.
A safeword is generally used so that the bottom can scream "no, stop", etc. as much as s/he wants without really meaning it, and yet still have a way of indicating a serious desire that the scene stops. Accordingly, a safeword is usually a word that the person would not ordinarily say during a scene, such as red, tree, anomaly, or even safeword.
Some partners have different gradations of safeword, such as yellow to mean "that hurts" or "stop doing that" without stopping the scene, and red to mean "let's stop the scene". (This reflects the red, yellow/amber, green of traffic lights.) This is especially useful for a Top who is inexperienced with the bottom and who might over-step what is pleasureable or bearable.
The safeword may not be a "word" at all, but a signal like dropping a ball or similar, or making three clear and rhythmic grunts or specific motions. This is particularly useful in the case of a person who is gagged or bound.
Another convention is the reversal of the safeword principle. For example, a signal can be agreed on where the Top might put a finger in the bottom's hand if the bottom has become non-verbal (which may happen as they reach subspace or may happen if they become distressed). In this scenario the bottom squeezes a pre-determined number of times to indicate that they are OK and happy to procede. If the signal is not received, the scene must stop.
A common request from the top to the bottom, to check on their status, is to ask "What is your colour?" In addition to red and yellow, green is a common safe word used to indicate, "I'm fine" or perhaps "more please!"
In the case of role-playing, some simply drop out of character to safeword, such as having the submissive address the dominant by his/her first name. It is not enough just to drop out of roleplay because this can be a lapse on the part of the roleplayer and might otherwise be a matter for discipline.
While many in the BDSM community consider safewords an essential part of safe play, there is a significant contingent that does not have any such term in their relationships or their play. Some of these people simply use the word Stop. Others rely on the top to monitor the condition of the bottom and stop if necessary, at their discretion. In such circumstances the bottom or submissive must have consented not to have control over the duration of the scene in advance. (Note that in future UK law, it is not enough to have consented never to have a safeword: such consent must be given before every scene to have any legal applicability.)
Interestingly, some of those who recommend safewords do not, themselves, use them though this is not often discussed in public. There is an undercurrent assumption that play without safewords is an "advanced" technique and should not be advocated in the hearing of novices. BDSM activity without a safeword is regarded by many as inadvisable and dangerous. Another group within BDSM who tend not to use safewords are those in a total power exchange relationship; in this case, and after a time of building trust where safewords might be used, the ability for the slave to direct any action of the Master is against the principles of the relationship the two desire.
If used, the "stop" safeword should be respected unconditionally. After the bottom uses the safeword, the activity or entire scene is over, inflicting pain or any physical forcing should be stopped and all restraints should be removed immediately. Ignoring safewords is considered dishonorable and a deeply immoral practice in the BDSM community and can lead to criminal charges. (The "yellow safeword" mentioned above is however not obligatory.) The precise safeword(s) should be discussed clearly; if one is used to one word and the other used to another word, there is little harm in agreeing that either word will act as a safeword.
The fact that a safeword might have been agreed on does not lessen the top's responsibility for the well-being of the sub under the top's control. It is quite possible that the sub may not be in an alert enough metal state or be too distressed to issue the safe word when in fact the scene has gone beyond what they can endure. The top should always take active steps to check on the mental and physical state of their sub and not just assume the sub will "call time" when they have had enough.