Hydrogen Peroxide works great for cleaning ears and when you buy ear cleaning solutions hydrogen peroxide is one of the ingredients in those ear cleaning solutions.
I take an ear dropper and drop a few drops of hydrogen peroxide into my ears and then use a cotton swab to gently remove the dirt and excessive earwax.
Some ear wax is needed to keep your ears from becoming infected so you don't need to remove it all but keeping some of the old earwax out is needed for good hearing and hygiene.
Never force the cotton swab too far into your ear as you can damage your ear and lose your hearing.
Just gently swab the ear.