Skip to main content

Available formats

Universal Speedtest CLI supports two output formats:
  1. Human-readable format (default) - Colored, formatted text with progress updates
  2. JSON format - Machine-readable structured data for automation

Human-readable format

The default format provides a rich, interactive experience with:
  • Real-time progress updates during testing
  • Color-coded output for better readability
  • Formatted report with clear sections
  • Network quality scores and recommendations
unispeedtest

Color support

The human-readable format uses ANSI color codes to highlight:
  • Bold text for section headers
  • Green for speed values
  • Magenta for latency and jitter
  • Color-coded quality scores (green for Good, red for Poor)
Colors are automatically disabled when:
  • The NO_COLOR environment variable is set
  • TERM=dumb is detected
  • Output is piped to a file or another command
The color logic is implemented in internal/color/color.go:16-26. The tool respects the NO_COLOR standard.

JSON format

Use the -json flag to output results as JSON:
unispeedtest -json

Differences from human-readable format

No progress output

Progress messages are suppressed. The tool runs silently until completion.

No colors

Plain JSON output without ANSI color codes.

Compact by default

Single-line JSON output (use -pretty for formatted JSON).

Machine-readable

Structured data that’s easy to parse programmatically.

Pretty-printed JSON

For human-readable JSON with indentation:
unispeedtest -pretty
The -pretty flag automatically enables JSON output, so you don’t need to specify -json as well.

When to use each format

Use human-readable format when:

  • Running tests interactively from the terminal
  • You want to see progress updates in real-time
  • You need to quickly interpret results visually
  • Troubleshooting network issues manually

Use JSON format when:

  • Integrating with monitoring systems
  • Automating speed tests in scripts
  • Storing results in a database
  • Processing results with other tools (jq, scripts, etc.)
  • Running tests in CI/CD pipelines
  • Building dashboards or reports

Disabling color output

There are multiple ways to disable color output while keeping the human-readable format:

Using NO_COLOR environment variable

NO_COLOR=1 unispeedtest
This follows the NO_COLOR standard and is the recommended approach.

Using TERM environment variable

TERM=dumb unispeedtest
Useful when running in environments that don’t support ANSI codes.

Piping output

When output is piped, color codes are still included by default. Use NO_COLOR to strip them:
NO_COLOR=1 unispeedtest | tee results.txt
Color codes in piped output may appear as escape sequences (e.g., \x1b[32m) in text files. Always use NO_COLOR when saving human-readable output to files.

Format selection reference

FlagOutput FormatProgressColorsUse Case
(none)Human-readableYesYes*Interactive terminal use
-jsonJSONNoNoAutomation, compact output
-prettyJSONNoNoAutomation, readable JSON
* Colors automatically disabled if NO_COLOR is set or TERM=dumb

Implementation details

The output format is controlled by flag parsing in cmd/unispeedtest/main.go:16-24:
  • When -json or -pretty is set, the verbose flag is disabled
  • When verbose is false, progress functions become no-ops
  • The reporter chooses between PrintHuman() and PrintJSON() based on the verbose flag
if verbose {
    reporter.PrintHuman(os.Stdout, result)
} else {
    if err := reporter.PrintJSON(os.Stdout, result, *prettyOut); err != nil {
        fmt.Fprintf(os.Stderr, "error encoding JSON: %v\n", err)
        os.Exit(1)
    }
}

Build docs developers (and LLMs) love