Rings of single-walled carbon nanotubes (SWNTs) were assembled by dip-pen nanolithography (DPN) generated molecular templates consisting of COOH-terminated monolayers in circular patterns surrounded by passivating CH3-terminated SAMs. Experimental data and atomic-level Monte Carlo simulations show that SWNTs assemble into rings with radii as small as 100 nm at the edge of the COOH templates. This directed assembly is strongly length-dependent; only when the length of a SWNT is longer than half of the circumference of the circle does the SWNT bend to precisely follow the interface of the COOH-terminated monolayer. The theoretical modeling shows that the strain energy of each SWNT is balanced by the energy difference between the van der Waals interactions of the tube with COOH and CH3 templates to produce the resulting ring structure.