WHAT IS ALREADY KNOWN ON THIS TOPIC Restricting access to means has been shown to be an effective suicide prevention measure in public places in general, and in the railway environment specifically. Some examples of restricting access to means that have been effective in the railway environment include the installation of platform screen doors and the removal of level crossings. WHAT THIS STUDY ADDS Our study adds to knowledge about restricting access to means in the railway environment by examining the effectiveness of the installation of trackside fencing, and in particular, by examining whether differences in effectiveness exist depending on the length of the fencing installed. We identified a 57% reduction in suicides if the fencing was at least 100 metres long. HOW THIS STUDY MIGHT AFFECT RESEARCH, PRACTICE OR POLICY This finding has implications for designing barrier interventions like trackside fencing and selecting fencing locations to prevent railway suicide. Our study suggest that authorities who are responsible for installing fencing on railway networks may wish to prioritise sites where longer runs of fencing can be installed.