Hey there!
As muguy had mentioned, iCloud is more of a syncing service than it is an online storage locker. The data needs to be stored on at least one device, in order for the data to stay there and sync with your other devices using iCloud.
However, iCloud does also help with your devices local storage. Say your Mac or iPhone was running out of storage, you can use iCloud to "Optimize Storage" in which the iCloud Storage you have helps to alleviate the limited storage on your devices, while you can still see and access this data on your devices.
You can as well, use iCloud Drive say on one device, but not the other, if you want to make sure the data, and changes made on one device don't affect the other. Or that the data and changes you make on one device, don't affect the data you have in iCloud.
So you could of course offload these files to an external hard drive, or some other non-Apple storage company, then delete them from your Mac, this is one way to remove them from your Mac and save a copy. Likewise, you can move them to iCloud Drive to sync to another device you have, THEN disable iCloud Drive on your Mac, then removing the files just from your Mac, yet they are available on your other devices.
Although if it is your local Mac storage that you are worried about, you can turn on Optimize Storage. If you have enough storage in iCloud, you can continue to keep adding files to your Mac, without burdening the hard drive space. The same goes for photos. If you store photos in iCloud, and your iPhone, iPad, Mac, etc. storage is limited, you can still continue to add photos to that device, and iCloud will take care of it.
Hope that helps, otherwise, can I ask what your main concern is? Of if there is another reason you wanted to do this? Glad to help out if I can!
Sign in to iCloud on all your devices - Apple SupportOfficial Apple Support › guide › icloud › icloud
Learn more about how each app or feature uses iCloud
Optimize storage space on your Mac - Apple SupportOfficial Apple Support › guide › mac-help › mac
Manage your photo and video storage - Apple SupportOfficial Apple Support › en-us