Metal-free nitrogen-containing carbon nanotubes prepared from triazole and tetrazole derivatives show high electrocatalytic activity towards the oxygen reduction reaction in alkaline media.