> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/grafana/k6/llms.txt
> Use this file to discover all available pages before exploring further.

# k6 version

> Display k6 version information

# k6 version

Show the k6 version and build information.

## Synopsis

```bash theme={null}
k6 version [flags]
k6 --version
```

## Description

The `k6 version` command displays version and build information for the k6 binary. This includes:

* k6 version number
* Git commit hash (if available)
* Go version used to build k6
* Operating system and architecture
* Loaded extensions (if any)

## Examples

```bash theme={null}
# Show version (standard format)
k6 version

# Show version (short format)
k6 --version

# Show version in JSON format
k6 version --json
```

## Flags

<ParamField path="--json" type="boolean">
  Output version information in JSON format
</ParamField>

## Output Format

### Standard Output

The standard output format shows a human-readable version string:

```
k6 v0.48.0 (commit/a1b2c3d4, go1.21.4, linux/amd64)
```

This includes:

* Version number (e.g., `v0.48.0`)
* Git commit hash (e.g., `a1b2c3d4`)
* Go version (e.g., `go1.21.4`)
* Platform (e.g., `linux/amd64`)

### With Extensions

If k6 extensions are loaded, they are listed:

```
k6 v0.48.0 (commit/a1b2c3d4, go1.21.4, linux/amd64)
Extensions:
  github.com/grafana/xk6-browser v1.0.0
  github.com/grafana/xk6-sql v0.1.0
```

### JSON Output

With the `--json` flag, output is structured JSON:

```json theme={null}
{
  "version": "v0.48.0",
  "commit": "a1b2c3d4",
  "commit_dirty": false,
  "go_version": "go1.21.4",
  "go_os": "linux",
  "go_arch": "amd64",
  "extensions": [
    {
      "module": "github.com/grafana/xk6-browser",
      "version": "v1.0.0",
      "outputs": [],
      "imports": ["k6/x/browser"]
    }
  ]
}
```

## Version Components

### Version Number

The semantic version of k6 (e.g., `v0.48.0`). Follows [Semantic Versioning](https://semver.org/):

* Major version: Breaking changes
* Minor version: New features (backwards compatible)
* Patch version: Bug fixes

### Commit Hash

The Git commit hash from which k6 was built. Useful for:

* Identifying exact build
* Debugging issues
* Verifying builds

If the working directory had uncommitted changes, `-dirty` is appended.

### Go Version

The version of Go used to compile k6. Important for:

* Compatibility verification
* Performance characteristics
* Security updates

### Platform

The target operating system and architecture:

* `linux/amd64` - 64-bit Linux
* `darwin/amd64` - Intel Mac
* `darwin/arm64` - Apple Silicon Mac
* `windows/amd64` - 64-bit Windows

## Use Cases

### Bug Reports

Include full version information in bug reports:

```bash theme={null}
k6 version --json > version-info.json
```

### CI/CD Verification

Verify the correct k6 version in pipelines:

```bash theme={null}
# Check minimum version
VERSION=$(k6 version --json | jq -r '.version')
if [[ "$VERSION" < "v0.48.0" ]]; then
  echo "k6 version too old"
  exit 1
fi
```

### Extension Verification

Check if required extensions are loaded:

```bash theme={null}
k6 version --json | jq -r '.extensions[].module'
```

### Debugging

Identify build characteristics:

```bash theme={null}
k6 version --json | jq '{version, commit, go_version}'
```

## Development Builds

Development builds show `(devel)` as the version:

```
k6 (devel) (commit/devel, go1.21.4, linux/amd64)
```

This indicates k6 was built from source without a version tag.

## Extensions Information

The output includes details about loaded k6 extensions:

* **Module**: Go module path
* **Version**: Extension version
* **Imports**: JavaScript import paths (for JS extensions)
* **Outputs**: Output names (for output extensions)

Example with multiple extension types:

```json theme={null}
{
  "extensions": [
    {
      "module": "github.com/grafana/xk6-browser",
      "version": "v1.0.0",
      "imports": ["k6/x/browser"]
    },
    {
      "module": "github.com/grafana/xk6-output-prometheus",
      "version": "v0.1.0",
      "outputs": ["prometheus"]
    }
  ]
}
```

## Exit Codes

* `0` - Command executed successfully

## See Also

* [k6 Extensions](https://k6.io/docs/extensions/)
* [Building k6 from source](https://k6.io/docs/getting-started/installation/)
