Information in this article applies to macOS Big Sur through High Sierra.
From the Apple menu, selectSystem Preferences.
On Big Sur, clickDock & Menu Bar.

Select theAutomatically hide and show the Dockbox to make the Dock go away when you’re not using it.
Remove the check mark if you want the Dock to remain visible all the time.
end the Dock’s preferences pane.

WhenAutomatically Hide and Show the Dockis selected, the Dock disappears when it’s not in use.
Use theCommand()+Option+Dkeyboard shortcutto toggle the Dock to show or hide.
With the cursor on the Dock separator, right-click and selectTurn Hiding Onto hide the Dock.

it’s possible for you to also use the Dock separator to access any of the Dock options quickly.
Right-click theDock separatorand selectDock Preferences.
Use theSizeslider to change the overall size of the Dock.

Magnification is the secret to using the smallest Dock possible.
Enable magnification by placing a check mark in theMagnificationbox in the Dock preferences.
Then, use the magnification slider to set the expanded-view size of the Dock.

Subtle Dock Changes
There is more to the Dock than hiding and showing.
Use your Mac with the Dock visible and then invisible, and see which way you like it best.