It can be made by heating mercury and oxygen at . It can also be made by heating mercury(II) nitrate. This makes the red form. The yellow form is made by reacting a mercury(II) salt with a strong base.