Updated:

Turn it on

Either works:

Also set enforce-whitelist=true so players removed from the list are kicked immediately.

Commands (Java)

CommandDoes
whitelist add NameAdds a player
whitelist remove NameRemoves a player
whitelist listShows the list
whitelist on / offTurns it on or off
whitelist reloadRe-reads whitelist.json

No slash in the console. In game you need operator permission and type /whitelist add Name.

When adding players

Editing whitelist.json

The list lives in whitelist.json in the server folder. After editing it by hand, run whitelist reload. Adding with the command avoids UUID typos.

"You are not white-listed on this server!"

Bedrock Dedicated Server

Bedrock calls it the allowlist: set allow-list=true and add players with allowlist add Name. It is saved in allowlist.json.

Common questions

Check your command

The Command Error Doctor checks common syntax mistakes in your browser.