You can buy a gauge and that's a good way to do it. You can also use a wooden dowel, a razor blade, and a good pair of calipers.
Close the bolt, and put the dowel down the barrel until it contacts the bolt face. Hold the razor blade flat against the end of the barrel and make a mark on the dowel. Sometimes I'll paint the Dowel white so I can see it better.
Remove the bolt. Drop the bullet you plan to use into the chamber and gently tap the back of the bullet with the dowel rod. Gently now.
Now stick the dowel down the barrel until it contacts the bullet and make a mark on the dowel again.
Take your calipers and carefully measure the distance between the two marks. If you load at this length, it's very likely you can pull a bullet opening the bolt and don't powder in your chamber.
If you want to double check the dimension, back off 0.005 in with a loaded round. Same bullet. Use an expo dry erase marker on the bullet and drop it into the chamber is straight as you can with the barrel pointed down. Close the bolt. If you get five or six cute little rifling marks you are right at contact, but not necessarily jammed. Some people use smoke from a candle. I've done that too.
The shape of the bullet has a very gentle approach to full bore diameter. And there is a lead in chamfer where the rifling starts. Both of these things make measuring linear distances down the bore a little bit difficult.
I keep a 3/16, 1/4 and 5/16 dowel stick in my reloading area. No matter what the caliber is, I can knock this out and be reloading cartridges in 5 to 10 minutes.
I know the gauges are a more purist way. And that's okay with me. But this is an option, and it does work as long as you can make good measurements. And you can get everything you need at a hardware store.
If you ever have a rifle barrelled you can potentially start the lands at the distance from the bolt that you want. I usually use the most important bullet I plan to shoot, and set the lands up to jam the bullet 0.020 less than mag length.
A lot of factory rifles have so much freebore you can't get anywhere close to contact at mag length. I've even had factory barrels rechambered to put the lands where I want them so I don't have to single load the ammunition that shoots best.
Anyhoo, that's one way to do it, and it's one way of many that can work.