Use a mod (java edition). Mods are the only way to get new capes for Java Minecraft. Although you can technically get any type of cape using Minecraft mods you won't be able to see them unless you're using the exact same mod. It's worth checking out these mods. - Advanced Capes Mod is a popular mod for getting capes. You can install it as long as Minecraft Forge is installed. After you have installed Advanced Capes Mod, you will be able to set your cape by pressing C and adding the URL. You can download the cape template and edit it with Paint or any other editing app. Then upload the edited version to an image hosting site like Imgur.
Optifine comes with a cape. But you will be the only one who sees it. It can still be fun to have a cool cape especially if you stream your gameplay. Go to Settings > Skin customization > OptiFine Cape > Open Cape editor to change the cape's appearance.