Every grain of sand on earth has its own ID.
Clone or download



Build Status Coverage Status Go Report Card GoDoc

Every grain of sand on earth has its own ID.

It should be noted that the algorithm used to generate the SandID in this project mainly come from the UUID version 1. Some adjustments were made to enhance the efficiency of database insertion (see this).


  • Extremely easy to use
  • Fixed length
    • 16 bytes
    • 22 characters
    • 128-bit
  • Huge capacity
    • Up to 2e128
  • URL safe
    • ^[A-Za-z0-9-_]{22}$
  • Encoding friendly
    • Implemented encoding.TextMarshaler and encoding.TextUnmarshaler
    • Implemented encoding.BinaryMarshaler and encoding.BinaryUnmarshaler
    • Implemented json.Marshaler and json.Unmarshaler
  • SQL friendly
    • NullSandID support
    • Implemented sql.Scanner and driver.Valuer


Open your terminal and execute

$ go get github.com/aofei/sandid


The only requirement is the Go, at least v1.2.


If you want to discuss this project, or ask questions about it, simply post questions or ideas here.


If you want to help build this project, simply follow this to send pull requests here.


This project is licensed under the Unlicense.

License can be found here.