
Narita town shares its rail lines with the airport, so it's easy to reach - and trivial if you're already at the terminals. From central Tokyo you've got a fast option (Skyliner) and a cheaper, slightly slower one (the Keisei main line or JR).
Aim for Keisei-Narita or JR Narita station - both sit at the top of the Omotesando approach street, a 10-15 minute downhill walk to the temple. If you're on a layover, the ~10-minute hop from the airport plus station lockers makes a quick visit very doable.
Take the Keisei Skyliner (~60 min, fastest) or the cheaper Keisei main line / JR (~75-80 min) from Ueno or Tokyo Station to the Narita station at the top of the temple approach.
About 10 minutes by train - get off at Keisei-Narita or JR Narita rather than continuing to the terminals. Ideal for a layover visit.