Programmed ribosomal frameshifting is the controlled slippage of the translating ribosome to an alternative frame. This tightly regulated process is widely employed by human viruses such as HIV and SARS-CoV and is critical for their life cycle and virulence. It is also utilized throughout the tree of life to implement a feedback control mechanism to regulate polyamine levels. However, despite its universality and clinical relevance, a limited number of studies investigated this process on only a few selected examples, largely due to a lack of experimental means. Here, we developed a high-throughput, fluorescence-based approach to assay the frameshifting potential of a sequence. We designed and tested >12.000 sequences based on 15 viral and human frameshifting events, allowing us to elucidate the rules governing ribosomal frameshifting in a systematic way and to discover novel regulatory features. We also utilized our approach to search for novel frameshifting events and identified dozens of previously unknown frameshifting sites in human, showing that programmed ribosomal frameshifting is more common than previously anticipated. We assessed the natural variation in HIV gag-pol frameshifting rates by testing >500 clinical isolates and identified subtype-specific differences as well as associations between viral load in patients and the optimality of gagpol frameshifting rates. We further devised a machine learning algorithm that accurately predicts frameshifting rates of novel variants (up to r=0.70), including subtle differences between HIV isolates (r=0.44), providing a basis for the development of antiviral agents acting on programmed ribosomal frameshifting.