Developer UUID tools

Go UUID Generator

Generate UUIDs for Go services, tests, migrations, and request IDs, then review common package-based Golang examples.

Go UUID generator

Create UUID values for Go fixtures, APIs, database rows, and logs.

123e4567-e89b-42d3-a456-426614174000
123e4567-e89b-42d3-a456-426614174001
123e4567-e89b-42d3-a456-426614174002
123e4567-e89b-42d3-a456-426614174003
123e4567-e89b-42d3-a456-426614174004
123e4567-e89b-42d3-a456-426614174005
123e4567-e89b-42d3-a456-426614174006
123e4567-e89b-42d3-a456-426614174007
123e4567-e89b-42d3-a456-426614174008
123e4567-e89b-42d3-a456-426614174009
Output options

Generate 1 to 1000 IDs per batch.

Generated values stay in your browser. This page does not send UUIDs or GUIDs to a server for generation.

Install a Go UUID package

Go projects commonly use a UUID package such as github.com/google/uuid for generation and parsing.

Install Go UUID package
go get github.com/google/uuid

Generate and parse UUIDs in Go

Use uuid.NewString() for a string value and uuid.Parse() when validating external strings.

Generate and parse UUIDs in Go
package main

import (
    "fmt"
    "github.com/google/uuid"
)

func main() {
    id := uuid.NewString()
    parsed, err := uuid.Parse(id)
    fmt.Println(parsed, err)
}

Common Go UUID mistakes

Handle parse errors instead of assuming incoming strings are valid. Prefer a UUID package over a hand-written random string function.

FAQ

How do I generate a UUID in Go?+

Use a UUID package such as github.com/google/uuid and call uuid.NewString().

How do I parse a UUID in Go?+

Call uuid.Parse(value) and handle the returned error.

Does Go have UUIDs in the standard library?+

Go's standard library does not provide a high-level UUID generator, so projects usually use a maintained package.