Note that hardcore mode only exists in Minecraft Java Edition.
Hardcore mode locks your game to the highest difficulty and prevents players from respawning after they die.
Enable hardcore mode for new worlds:
You can enable hardcore mode when generating a new world on the Worlds page:
Enable hardcore mode for existing worlds:
You have to enable hardcore mode in your server.properties settings here:
And enable it for your existing world(s) in the level.dat file here:
It's recommended to do this while your server is offline.
Disable hardcore mode for existing worlds:
You can generate a new world or disable hardcore mode in your current world by first disabling it in the server.properties settings here:
And disable it for your existing world(s) in the level.dat file here:
If you've died in hardcore mode, and you are still in spectator mode, you have to change your gamemode.