With no mods, your ability to zoom in Minecraft is limited to the FOV setting, which changes your wide or narrow your character’s point of view is.
In the pause menu, click on Options and you will see the FOV slider on top. By default, it will be set to Normal, which is numerically set to 70.
By bringing the FOV to 30, your point of view will become much narrower and zoomed in, letting you see further but with a minimal peripheral view.
You can see the opposite effect by widening the FOV to a higher number, which lets you see much more to your left and right but makes the distant objects feel even further.
OptiFine for Java
For a more streamlined ability to zoom in-game, you will need to download a mod.
For the Java edition, the mod OptiFine is hosted on Optifine.net, where you can find the latest release under Downloads.
Make sure that you download a version that matches your Minecraft version.
If you do not have it already, you may need to install Java SE to open the mod. Go to the Download page on the Oracle site to grab the latest version and install it on your computer.
With Java installed, go to your OptiFine file and open with Java.
The installer will walk you through a few simple prompts. Once finished, you will be prompted to click on OK, which will install OptiFine as a module in the game.
Start the Minecraft launcher, and on the bottom left, confirm OptiFine appears or is selected where it says the latest release.
Now in-game, you can confirm that your zoom mod is installed by pressing and holding the C key to zoom in and out with a simple press.
If you would like to change that hotkey, navigate the game menu to Options > Controls, and then scroll to the miscellaneous section. Here, you will find an entry for zoom. From here, you can select whichever key you prefer to utilise the OptiFine functionality in-game.