It is often argued that informal labour markets in developing countries are the engine of growth because their existence allows firms to operate in an environment where wage and regulatory costs are lower. On the other hand informality means that the amount of social protection offered to workers is lower. In this paper we extend the wage-posting framework of Burdett and Mortensen (1998) to allow for two sectors of employment. Firms are heterogeneous and decide endogenously in which sector to locate. Workers engage in both off the job and on the job search and decide which offers to accept. Direct transitions across sectors are permitted, which matches the evidence in the data about job mobility. Our empirical analysis uses Brazilian labour force surveys. We use the model to discuss the relative merits of alternative policies towards informality. In particular, we evaluate the impact of a tighter regulatory framework on employment in the formal and the informal sector and on the distribution of wages.