Just like any musical instrument, your trumpet will not make beautiful music if it's not in tune. The trumpet has four different tuning slides that you will use to keep your trumpet in tune.
Find your tuning sides. There are four slides on a trumpet that all affect the tuning of your instrument. The main tuning slide is the big one located at the end of your lead pipe opposite of your mouthpiece. The first valve slide comes out toward your mouthpiece from the first valve. The second valve slide extends outward from the middle valve and the third valve slide extends toward the bell from the third valve.
Adjust your main tuning slide. This slide will be the place that you set your main tuning, and you will use the valve slides to fine tune. The best way to tune is to play an open note like a C or G. Use a tuner or other instrument to tune with and adjust the main tuning slide until your note is in tune. Extend the slide if you are sharp and shorten it if your note is flat.
Keep your finger ready on the third valve slide and possibly the first valve slide. Tuning on a trumpet varies from note to note so you will have to use the third valve slide and possibly the first valve slide to keep some notes in tune.
For instance, a D played with the first and third valves is often going to be sharp even when your trumpet is in tune. Use the finger hook for your pinky on the third valve slide to extend the slide every time your play a D. Some trumpets have a finger hook on the first valve slide as well, so you can adjust it as necessary on the fly.
Make notes of where your tuning slides need to be. There is no exact place, but you will learn some notes that you play will consistently be out of tune. Adjust the tuning slides on the individual valves to keep all your notes in tune.
Be ready to keep changing your tuning slides. There are many variables on how well your instrument plays in tune, such as the temperature of the instrument, how warmed up your lips are and what style and dynamics you're playing in. Don't get set on one place where your tuning slides should be, but instead keep your ears open and adjust constantly.
Make sure you keep your slides well greased so that they do not stick.