Layer-by-layer (LbL) assembly technique is applied for the first time for the preparation of nitrogen-doped carbon capsules. This approach uses colloid silica as template and two polymeric deposition components, that is, poly(ammonium acrylate) and a poly (ionic liquid) poly(3-cyanomethyl-1-vinylimidazolium bromide), which acts as both the carbon precursor and nitrogen source. Nitrogen-doped carbon capsules are prepared successfully by polymer wrapping, subsequent carbonization and template removal. The as-synthesized carbon capsules contain ≈7 wt% of nitrogen and have a structured specific surface area of 423 m2 g−1. Their application as supercapacitor has been briefly introduced. This work proves that LbL assembly methodology is available for preparing carbon structures of complex morphology.