OpenHome is an open source tool for moving Pokémon between game save files, including forwards and backwards through generations, without data loss.
When a Pokémon is moved into a save file, its data from other games is saved locally, so nothing is lost when transferring to past generations.
For example, a Sceptile with the Kalos Champion ribbon can be moved from Pokémon X to Pokémon Ruby, earn the Artist Ribbon, and it will have both the Kalos Champion and Artist ribbons when moved back to Pokémon X.
When moving Pokémon to an older game, some compromises have to be made. OpenHome will try its best to preserve aspects of a Pokémon such as its nature, ability, gender, and shininess, all of which are usually possible minus some specific cases in the GameBoy games. These compromises will be reverted when moving back to a future game.
For example, a Pokémon originating in Generation 6 being moved into a Generation 3 game will have its personality value altered to preserve its nature, ability (if possible), gender, and shininess.
A Pokémon transferred into Generation 1 or 2 will have it's Original Trainer's ID changed to a "tracking number" of sorts due to the lack of a Personality Value in those games.
Development is ongoing. While OpenHome does its best to convert Pokemon between formats losslessly, there are sometimes mistakes. It's always a good idea to back up your save files. If you come across a bug, create a GitHub Issue to bring it to my attention.
All PKM formats from Generations I-IX are currently supported, including from Pokémon Colosseum and Pokémon XD. All game save files from Generations I-VII are supported, except for Pokémon Lets Go Pikachu/Eevee and the Japanese versions of Pokémon Red/Green/Blue/Yellow. Support for Switch game save files will come at some point in the future.
This application would not have been possible without the research done at https://projectpokemon.org/, the work done by the PKHeX developers, and the sprites archived by https://pokemondb.net/ and https://www.bulbagarden.net/.