The present invention is directed to compounds of formula (I) and pharmaceutically acceptable salts, esters, and prodrugs thereof which are inhibitors of Factor Xa. The present invention is also directed to intermediates used in making such compounds, pharmaceutical compositions containing such a compound, methods to prevent or treat a number of conditions characterized by undesired thrombosis and methods of inhibiting the coagulation of a blood sample.