Q.How to Prune Tomatoes
My tomato plant gets leggy and grows out of the cage. Is there aproper way to prune them?

Certified GKH Gardening Expert
If they are becoming "leggy", this indicates that they are not getting enough light.
We normally do not advise pruning tomatoes, but if you decide to prune, use a very clean pair of shears and cut at the place where the branch you are trimming meets the stem. Allow it to air dry and do not water the foliage of the plant for a day after you prune. This article should help as well: https://www.gardeningknowhow.com/edible/vegetables/tomato/should-you-prune-tomato-plants.htm

Start out strong and plant em deep! If you start with a small plant, say in a 4" or qt size container, when the tomatoes are very first planted, pick all the lower branches off until you're left with a long thin central stem and a small but balanced "canopy." Now, plant it deep. Dig the hole deep enough so that the lowest branch that was left after your picking is just above the final soil level. This might mean the top of the root ball is 8" or more under the surface. I know it sounds crazy but it makes for strong sturdy tomato vines. All the little hairs on the stem turn into roots. Disclaimer: Tomatoes are the only plant I know of where it trick works, in every other case I'm aware of putting the rootball of a starter plant 8" below soil level will absolutely kill it.
Make sure you don't water too much or go for long periods between waterings. Soil moist but not wet, so important. Tomatoes do like the the soil to dry out slightly between waterings, but not for an extended period.
Full Sun if possible!
I like to prune mine so that they stay thin in the middle, no small branches, and then use grafting tape to encourage the vines to "zig-zag" around the cage/wire in a spiral.
Good luck