OPTIMASS: A Package for the Minimization of Kinematic Mass Functions with Constraints. Reconstructed mass variables, such as M2, M2C, M⋆T, and MWT2, play an essential role in searches for new physics at hadron colliders. The calculation of these variables generally involves constrained minimization in a large parameter space, which is numerically challenging. We provide a C++ code, OPTIMASS, which interfaces with the MINUIT library to perform this constrained minimization using the Augmented Lagrangian Method. The code can be applied to arbitrarily general event topologies and thus allows the user to significantly extend the existing set of kinematic variables. We describe this code and its physics motivation, and demonstrate its use in the analysis of the fully leptonic decay of pair-produced top quarks using the M2 variables.