An imaging lens includes a lens barrel, an imaging unit and a light shielding unit. The lens barrel includes a base wall formed with a light incident hole at an optical axis of the imaging lens and a surrounding wall that extends from and cooperates with the base wall to define a receiving space. The imaging unit includes a plurality of imaging components each having an annular front contact surface and an annular back contact surface. The light shielding unit includes an annular retaining portion clamped between an adjacent pair of the imaging components, an object-side protruding portion with a first edge, and an image-side protruding portion with a second edge.