Is there any algoritm which can pack rectangles?

Hi guys. I need to make town generation system, and the best idea I have gotten is firstly pack rectangles, then space them a bit to make roads, and finally replace rectangles with buildings.
But I’m struggling a lot in packing said rectangles - they overlap, or space a lot. Is there any algoritm which can pack rectangles, preferably starting from zero point and packing as close to it, as possible (but that’s not that important).