The analysis and measurement of production and transaction costs is an important tool in guiding decisions and in comprehending the behavior of the agents in a particular institutional environment. Although production costs have been widely studied in the literature, transaction costs have not been so extensively analyzed, especially empirically. Based on 125 questionnaires and on theoretical review, this work presents an analysis and a measurement of the transaction costs for two groups of rural producers in the region of São Carlos, in São Paulo state. The groups were defined using cluster analysis, considering the amount of milk sold in the informal market as the analysis variable. The theoretical reference includes the New Institutional Economics and Transaction Cost Economics theories. It was concluded that, although transaction costs are low for both groups, they are relatively higher for producers inserted mainly in the informal market than for producers inserted in the formal market. Moreover, a small number of formal contracts were observed, which can be explained by the high frequency of transactions and the consequent establishment of reliability.