= Set the Safe Mode Using the CLI
:navtitle: Set Safe Mode

When Asciidoctor is invoked via the CLI, the xref:ROOT:safe-modes.adoc[safe mode] is set to `UNSAFE` by default.

== Assign safe mode level

You can change the security level by executing one of the following commands:

`-S`, `--safe-mode=SAFE_MODE`::
Sets the safe mode level of the document according to the assigned level (`UNSAFE`, `SAFE`, `SERVER`, `SECURE`).

`--safe`, `asciidoctor-safe`::
Sets the safe mode level to `SAFE`.
Provided for compatibility with the python AsciiDoc `safe` command.

////
-B, --base-dir=DIR
Base directory containing the document and resources. Defaults to the directory containing the source file, or the working directory if the source is read from a stream. Can be used as a way to chroot the execution of the program.
////

You can also set the xref:api:set-safe-mode.adoc[safe mode from the API] and xref:ROOT:reference-safe-mode.adoc[enable or disable content based on the current safe mode].
