CLI Options Reference
Comprehensive reference for all k6 command-line options.Overview
k6 accepts configuration through multiple sources (in order of precedence):- Command-line flags
- Environment variables
- Configuration file (
k6.json) - Script options (
export const options = {})
Global Flags
These flags are available for all k6 commands:Address of the REST API server. Use empty string to disable.
Path to the JSON configuration file.
Log output format:
text or json.Log output destination:
stderr, stdout, or a file path.Disable colored output.
Disable progress updates.
Enable verbose logging.
Enable profiling endpoints on the REST API.
Execution Options
Virtual Users and Duration
Number of virtual users to run concurrently.
Test duration limit. Accepts units:
s (seconds), m (minutes), h (hours).Total number of script iterations to execute across all VUs.
Ramping and Stages
Add an execution stage in the format This ramps to 50 VUs over 10s, maintains 50 VUs for 30s, then ramps down to 0 over 10s.
[duration]:[target]. Can be specified multiple times.Start the test in a paused state. Resume with
k6 resume.Distributed Execution
Run only a segment of the test for distributed execution.Formats:
- Percentage:
10% - Fraction:
1/4 - Range:
0.25:0.5
Define the segment sequence for distributed execution.
HTTP Options
Maximum number of HTTP redirects to follow.
Maximum number of parallel batch requests.
Maximum number of parallel batch requests per host.
Limit requests per second globally.
0 means unlimited.User-Agent string for HTTP requests.
Log HTTP requests and responses.
--http-debugor--http-debug=headers- Log headers only--http-debug=full- Log headers and bodies
Skip TLS certificate verification.
Disable HTTP keep-alive (connection reuse).
Don’t reuse connections between iterations within a VU.
Minimum time k6 will take to execute a single iteration.
Throw warnings as errors (e.g., failed HTTP requests).
Read HTTP response bodies but don’t save them. Reduces memory usage.
Network Configuration
Blacklist IP ranges from being called.
Block hostname patterns (case-insensitive, supports wildcards).
Specify local IP addresses or ranges for VUs to use.
DNS resolver configuration.Format:
ttl=VALUE,select=VALUE,policy=VALUEttl: Cache TTL (inf,0, or duration like30s)select: IP selection (first,random,roundRobin)policy: IP version policy (preferIPv4,preferIPv6,onlyIPv4,onlyIPv6,any)
Lifecycle Options
Skip running the
setup() function.Skip running the
teardown() function.Keep the REST API server running after the test finishes.
Output Options
Send metrics to an external output. Can be specified multiple times.Available outputs:
json, csv, cloud, influxdb, statsd, datadog, prometheus, opentelemetryEnd-of-test summary display mode.
compact- Condensed summary (default)full- Detailed summary with all metricsdisabled- No summary
Export the end-of-test summary to a JSON file.
Define statistics to calculate for trend metrics.Available:
avg, min, med, max, count, p(N) where N is 0-100Time unit for displaying trend statistics:
s, ms, or us.Redirect console logging to a file.
Disable anonymous usage statistics reporting.
Metrics and Tags
System tags to include in metrics.Available tags:
proto, subproto, status, method, url, name, group, check, error, tls_version, scenario, service, expected_responseAdd custom tags to all metrics.
Disable threshold execution.
Runtime Options
Set or override environment variables for the script.
Pass all system environment variables to the test script.
JavaScript runtime compatibility mode.
extended- Sobek withglobalalias forglobalThisbase- Pure Sobek (ECMAScript)experimental_enhanced- TypeScript and ES6+ via esbuild
Override test type detection.
js- JavaScript testarchive- Test archive
Tracing Options
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 usingk6.json.