In mathematics, a unary operation is an operation with only one operand, i.e. an operation with a single input, or in other words, a function of one variable (for the terminology see also operators versus functions). For instance, logical negation is a unary operation on truth values and squaring is a unary operation on the real numbers. A unary operation (or unary operator) on a given set S is nothing but a function SS, also called an endomorphism of S.

Common notations are prefix notation (+, -, not), postfix notation (factorial: n!), and functional notation (sin x or sin (x)). In the case of the square root a horizontal bar over the argument extending the square root sign can indicate the extent of the argument, so that parentheses can be dispensed with.

Unary operators (called "monadic" in APL) are also used in programming languages. For example, in the C family of languages, the following operators are unary:

While the above definition of a unary operation on a set S makes sense, the set must be specified. Without that, any arbitrary input can always be considered as a single entity of some, possibly quite complex, structure.