# ComfyUI Command-Line Arguments: A Complete Reference Guide

> Explore ComfyUI command-line arguments to control networking GPU VRAM model precision and UI easily. Leverage this complete reference guide for ComfyUI.

- Repository: [Comfy Org/ComfyUI](https://github.com/Comfy-Org/ComfyUI)
- Tags: api-reference
- Published: 2026-02-26

---

**ComfyUI exposes approximately 53 command-line arguments defined in [`comfy/cli_args.py`](https://github.com/Comfy-Org/ComfyUI/blob/main/comfy/cli_args.py) that control server networking, GPU device selection, VRAM management strategies, model precision formats, and UI customization.**

ComfyUI, the open-source node-based diffusion GUI maintained by Comfy-Org, provides extensive configuration flexibility through its command-line interface. Understanding the available **ComfyUI command-line arguments** is essential for optimizing performance across different hardware configurations, securing server deployments, and customizing directory structures. The argument parser initializes these options in [`comfy/cli_args.py`](https://github.com/Comfy-Org/ComfyUI/blob/main/comfy/cli_args.py) before PyTorch loads, ensuring hardware-specific environment variables are set correctly during early initialization in [`main.py`](https://github.com/Comfy-Org/ComfyUI/blob/main/main.py).

## Server and Networking Configuration

The HTTP/WebSocket server behavior is controlled through several networking flags parsed in [`comfy/cli_args.py`](https://github.com/Comfy-Org/ComfyUI/blob/main/comfy/cli_args.py) (lines 38-43) and implemented in [`server.py`](https://github.com/Comfy-Org/ComfyUI/blob/main/server.py).

- **`--listen`** – IP address (or CSV list) for the UI to bind. Defaults to `127.0.0.1`. Supplying the flag without a value binds to all IPv4/IPv6 interfaces.
- **`--port`** – TCP port for the HTTP server (default 8188).
- **`--tls-keyfile` / `--tls-certfile`** – Paths to TLS key and certificate files for enabling HTTPS.
- **`--enable-cors-header`** – Adds Cross-Origin Resource Sharing headers; accepts an optional origin or `*` for all origins.
- **`--max-upload-size`** – Maximum file upload size in MiB (default 100).

## Directory and File Path Configuration

ComfyUI’s directory layout can be completely customized using arguments processed by [`folder_paths.py`](https://github.com/Comfy-Org/ComfyUI/blob/main/folder_paths.py) and [`utils/extra_config.py`](https://github.com/Comfy-Org/ComfyUI/blob/main/utils/extra_config.py).

- **`--base-directory`** – Root folder containing *models*, *custom_nodes*, *input*, *output*, *temp*, and *user* subdirectories.
- **`--extra-model-paths-config`** – Load one or more [`extra_model_paths.yaml`](https://github.com/Comfy-Org/ComfyUI/blob/main/extra_model_paths.yaml) files to register additional model search paths.
- **`--output-directory`**, **`--temp-directory`**, **`--input-directory`** – Override specific subdirectories of the base path.
- **`--user-directory`** – Explicit path for user data (overrides `--base-directory`).

## Hardware and Device Selection

Device selection arguments in [`comfy/cli_args.py`](https://github.com/Comfy-Org/ComfyUI/blob/main/comfy/cli_args.py) (lines 52-53, 88-92) configure CUDA, DirectML, and Intel oneAPI backends before model loading.

- **`--cuda-device`** – Restrict the process to a single CUDA device index, hiding other GPUs from PyTorch.
- **`--default-device`** – Select a default CUDA device while keeping other devices visible.
- **`--directml`** – Use **torch-directml** for AMD/Intel GPU support on Windows; accepts optional device index (default -1).
- **`--oneapi-device-selector`** – Set Intel oneAPI device selector string for XPU acceleration.
- **`--disable-ipex-optimize`** – Disable automatic `ipex.optimize` for Intel extensions.
- **`--supports-fp8-compute`** – Force-enable FP8 compute support flags for testing purposes.

## Precision and Model Format Options

Model precision can be fine-tuned per component (UNet, VAE, text encoder) through flags defined in [`comfy/cli_args.py`](https://github.com/Comfy-Org/ComfyUI/blob/main/comfy/cli_args.py) (lines 60-86).

- **`--force-fp32`**, **`--force-fp16`** – Force the entire pipeline to FP32 or FP16 precision.
- **UNet precision** – `--fp32-unet`, `--fp64-unet`, `--bf16-unet`, `--fp16-unet`, `--fp8_e4m3fn-unet`, `--fp8_e5m2-unet`, `--fp8_e8m0fnu-unet`.
- **VAE precision** – `--fp16-vae`, `--fp32-vae`, `--bf16-vae`, or `--cpu-vae` to offload VAE decoding to CPU (useful for low-VRAM GPUs).
- **Text encoder precision** – `--fp8_e4m3fn-text-enc`, `--fp8_e5m2-text-enc`, `--fp16-text-enc`, `--fp32-text-enc`, `--bf16-text-enc`.
- **`--force-channels-last`** – Request channels-last tensor layout for improved performance on some GPU architectures.

## Memory Management and VRAM Optimization

VRAM handling strategies are critical for stable diffusion workloads. These arguments (lines 37-44, 145-169 in [`comfy/cli_args.py`](https://github.com/Comfy-Org/ComfyUI/blob/main/comfy/cli_args.py)) configure how models are loaded and offloaded.

- **VRAM strategies** – `--gpu-only`, `--highvram`, `--normalvram`, `--lowvram`, `--novram`, `--cpu` define where models reside (GPU only, aggressive offloading, or CPU-only).
- **`--reserve-vram`** – Reserve a fixed amount of VRAM (in GB) for the operating system and other applications.
- **Async offloading** – `--async-offload` enables async weight offloading with 2 streams by default; `--disable-async-offload` turns it off.
- **`--disable-pinned-memory`** – Disable pinned-memory usage for CPU-GPU transfers.
- **Memory mapping** – `--mmap-torch-files` enables memory-mapped loading for large checkpoints; `--disable-mmap` forces standard file loading.
- **`--disable-smart-memory`** – Force aggressive offloading to RAM rather than keeping models in VRAM between executions.
- **`--deterministic`** – Enable deterministic PyTorch algorithms for reproducibility (slower performance).

## Performance Tuning and Optimization Flags

Advanced performance options control cross-attention implementations and experimental optimizations.

- **`--fast`** – Enable experimental optimizations including `fp16_accumulation`, `fp8_matrix_mult`, `cublas_ops`, `autotune`, and `dynamic_vram`. Supplying no arguments enables all optimizations.
- **Cross-attention selection** – `--use-split-cross-attention`, `--use-quad-cross-attention`, `--use-pytorch-cross-attention`, `--use-sage-attention`, `--use-flash-attention`.
- **`--disable-xformers`** – Explicitly disable Xformers attention kernels if automatically detected.

## Security and Custom Node Controls

These flags manage the ComfyUI-Manager and custom node security posture.

- **`--enable-manager`** – Activate the ComfyUI-Manager plugin.
- **`--disable-manager-ui`** / **`--enable-manager-legacy-ui`** – Control manager UI visibility while keeping background tasks active.
- **`--disable-all-custom-nodes`** – Prevent loading any third-party custom node directories (useful for CI/CD).
- **`--whitelist-custom-nodes`** – Comma-separated list of custom node folders to load even when globally disabled.
- **`--disable-api-nodes`** – Block loading of API-exposing nodes and prevent internet calls from the frontend.

## Preview, Frontend, and Miscellaneous Options

Additional flags control UI behavior, logging, and database configuration.

- **`--preview-method`** / **`--preview-size`** – Choose preview rendering (`none`, `auto`, `latent2rgb`, `taesd`) and set maximum preview resolution.
- **`--auto-launch`** / **`--disable-auto-launch`** – Control automatic browser opening on startup.
- **`--multi-user`** – Enable per-user storage isolation (creates separate subdirectories for each OS user).
- **`--verbose`** / **`--log-stdout`** – Set logging level (`DEBUG` through `CRITICAL`) and redirect logs to stdout.
- **`--front-end-version`** / **`--front-end-root`** – Select specific frontend versions or point to local UI builds.
- **`--database-url`** – Override the SQLite database location or use in-memory storage.
- **`--disable-assets-autoscan`** – Skip automatic model asset database population at startup.
- **`--enable-compress-response-body`** – Enable HTTP response compression (gzip/deflate).
- **`--quick-test-for-ci`** – Exit immediately after successful startup for CI pipeline validation.
- **`--windows-standalone-build`** – Enable conveniences for the Windows standalone binary distribution.

## Practical Usage Examples

Configure ComfyUI for different deployment scenarios using these command patterns:

```bash

# Remote server with HTTPS, custom port, and CORS

python main.py --listen 0.0.0.0 --port 8888 --tls-keyfile key.pem --tls-certfile cert.pem --enable-cors-header "*"

# Low-VRAM GPU with CPU-offloaded VAE and async loading

python main.py --lowvram --cpu-vae --async-offload

# Deterministic FP16 workflow with specific CUDA device

python main.py --cuda-device 1 --force-fp16 --deterministic

# External storage layout with disabled custom nodes for testing

python main.py --base-directory /mnt/comfy_data --output-directory /mnt/comfy_data/output --disable-all-custom-nodes

# Enable all experimental fast optimizations

python main.py --fast

# Specific frontend version with preview enabled

python main.py --front-end-version Comfy-Org/ComfyUI_frontend@latest --preview-method latent2rgb --preview-size 512

```

## Summary

- **Configuration Source**: All arguments are defined in [`comfy/cli_args.py`](https://github.com/Comfy-Org/ComfyUI/blob/main/comfy/cli_args.py) and parsed before PyTorch initialization in [`main.py`](https://github.com/Comfy-Org/ComfyUI/blob/main/main.py).
- **Hardware Control**: Use `--cuda-device`, `--directml`, or `--oneapi-device-selector` to specify compute backends; VRAM strategies (`--lowvram`, `--highvram`, etc.) control memory residency.
- **Precision Tuning**: Component-specific flags (`--fp16-unet`, `--cpu-vae`, `--bf16-text-enc`) allow fine-grained control over model formats.
- **Security**: `--disable-api-nodes` and `--whitelist-custom-nodes` provide granular control over custom node execution and network access.
- **Performance**: The `--fast` flag bundles experimental optimizations, while specific attention implementations can be selected via `--use-*-cross-attention` flags.

## Frequently Asked Questions

### How do I bind ComfyUI to all network interfaces?

Use the `--listen` flag without specifying an IP address. According to the source code in [`comfy/cli_args.py`](https://github.com/Comfy-Org/ComfyUI/blob/main/comfy/cli_args.py) (line 38), supplying `--listen` alone binds to all IPv4 and IPv6 addresses, while `--listen 0.0.0.0` explicitly binds to all IPv4 interfaces.

### What is the difference between `--cuda-device` and `--default-device`?

`--cuda-device` restricts the process to a single GPU by hiding other CUDA devices from PyTorch entirely, while `--default-device` merely sets a preferred default device index while keeping all GPUs visible to the application. Both are processed in [`comfy/cli_args.py`](https://github.com/Comfy-Org/ComfyUI/blob/main/comfy/cli_args.py) (lines 52-53) before the CUDA runtime initializes.

### How can I run ComfyUI on systems with very limited VRAM?

Combine `--lowvram` or `--novram` with `--cpu-vae` to offload the diffusion model with aggressive memory management and force VAE decoding to CPU. For extreme constraints, use `--cpu` to run entirely on system memory, though this significantly reduces performance.

### Where does ComfyUI store its configuration and model files by default?

By default, ComfyUI uses relative directories (*models*, *output*, *input*, etc.) in the installation root. Override this using `--base-directory` to specify a new root, or use individual flags like `--output-directory` and `--user-directory` for specific paths. The [`folder_paths.py`](https://github.com/Comfy-Org/ComfyUI/blob/main/folder_paths.py) module handles these path resolutions during startup.