A classic route to carbodiimides involves dehydrosulfurization of thioureas. A typical reagent for this process is mercuric oxide:
:(R(H)N)CS + HgO → (RN)C + HgS + HO 
This reaction can often be conducted as stated, even though carbodiimides react with water.  In some cases, a dehydrating agent is added to the reaction mixture.
The dehydration of N,N'-dialkylureas gives carbodiimides:
:(R(H)N)CO  →  (RN)C  + HO 
Phosphorus pentoxide and p-Toluenesulfonyl chloride have been used as a dehydrating agents.