Skip to main content

CLI Options Reference

Comprehensive reference for all k6 command-line options.

Overview

k6 accepts configuration through multiple sources (in order of precedence):
  1. Command-line flags
  2. Environment variables
  3. Configuration file (k6.json)
  4. Script options (export const options = {})
CLI flags have the highest priority and will override all other sources.

Global Flags

These flags are available for all k6 commands:
string
default:"localhost:6565"
Address of the REST API server. Use empty string to disable.
string
default:"./k6.json"
Path to the JSON configuration file.
string
default:"text"
Log output format: text or json.
string
default:"stderr"
Log output destination: stderr, stdout, or a file path.
boolean
Disable colored output.
boolean
Disable progress updates.
boolean
Enable verbose logging.
boolean
Enable profiling endpoints on the REST API.

Execution Options

Virtual Users and Duration

int
default:"1"
Number of virtual users to run concurrently.
duration
Test duration limit. Accepts units: s (seconds), m (minutes), h (hours).
int
Total number of script iterations to execute across all VUs.

Ramping and Stages

string[]
Add an execution stage in the format [duration]:[target]. Can be specified multiple times.
This ramps to 50 VUs over 10s, maintains 50 VUs for 30s, then ramps down to 0 over 10s.
boolean
Start the test in a paused state. Resume with k6 resume.

Distributed Execution

string
Run only a segment of the test for distributed execution.Formats:
  • Percentage: 10%
  • Fraction: 1/4
  • Range: 0.25:0.5
string
Define the segment sequence for distributed execution.

HTTP Options

int
default:"10"
Maximum number of HTTP redirects to follow.
int
default:"20"
Maximum number of parallel batch requests.
int
default:"6"
Maximum number of parallel batch requests per host.
int
default:"0"
Limit requests per second globally. 0 means unlimited.
string
User-Agent string for HTTP requests.
string
Log HTTP requests and responses.
  • --http-debug or --http-debug=headers - Log headers only
  • --http-debug=full - Log headers and bodies
boolean
Skip TLS certificate verification.
boolean
Disable HTTP keep-alive (connection reuse).
boolean
Don’t reuse connections between iterations within a VU.
duration
Minimum time k6 will take to execute a single iteration.
boolean
Throw warnings as errors (e.g., failed HTTP requests).
boolean
Read HTTP response bodies but don’t save them. Reduces memory usage.

Network Configuration

string[]
Blacklist IP ranges from being called.
string[]
Block hostname patterns (case-insensitive, supports wildcards).
string
Specify local IP addresses or ranges for VUs to use.
string
DNS resolver configuration.Format: ttl=VALUE,select=VALUE,policy=VALUE
  • ttl: Cache TTL (inf, 0, or duration like 30s)
  • select: IP selection (first, random, roundRobin)
  • policy: IP version policy (preferIPv4, preferIPv6, onlyIPv4, onlyIPv6, any)

Lifecycle Options

boolean
Skip running the setup() function.
boolean
Skip running the teardown() function.
boolean
Keep the REST API server running after the test finishes.

Output Options

string[]
Send metrics to an external output. Can be specified multiple times.
Available outputs: json, csv, cloud, influxdb, statsd, datadog, prometheus, opentelemetry
string
default:"compact"
End-of-test summary display mode.
  • compact - Condensed summary (default)
  • full - Detailed summary with all metrics
  • disabled - No summary
string
Export the end-of-test summary to a JSON file.
string[]
Define statistics to calculate for trend metrics.Available: avg, min, med, max, count, p(N) where N is 0-100
string
Time unit for displaying trend statistics: s, ms, or us.
string
Redirect console logging to a file.
boolean
Disable anonymous usage statistics reporting.

Metrics and Tags

string[]
System tags to include in metrics.Available tags: proto, subproto, status, method, url, name, group, check, error, tls_version, scenario, service, expected_response
string[]
Add custom tags to all metrics.
boolean
Disable threshold execution.

Runtime Options

string[]
Set or override environment variables for the script.
boolean
Pass all system environment variables to the test script.
string
default:"extended"
JavaScript runtime compatibility mode.
  • extended - Sobek with global alias for globalThis
  • base - Pure Sobek (ECMAScript)
  • experimental_enhanced - TypeScript and ES6+ via esbuild
string
Override test type detection.
  • js - JavaScript test
  • archive - Test archive

Tracing Options

string
default:"none"
Configure distributed tracing output.
  • none - No tracing (default)
  • otel - OpenTelemetry to default endpoint (localhost:4317)
  • otel=host:port - OpenTelemetry to specified endpoint

Configuration File

See Configuration File Format for details on using k6.json.

Environment Variables

See Environment Variables for the complete list of supported environment variables.

See Also