You already have good advice on minimum chain length above. Here is a tip for stocking your on-bike repair kit. When you replace your chain, you usually will end up shortening it a few links. Keep that short section and put it in your tool kit along with a mini chain tool (if your multi-tool doesn't have one) and an appropriate quick link or two. They can come in handy if you really mangle a chain out in the boonies and have to cobble something together to get you home.