Diazomethane and the safer analogue trimethylsilyldiazomethane methylate carboxylic acids, phenols, and even alcohols:
The method offers the advantage that the side products are easily removed from the product mixture.