A command-line tool for decoding and inspecting JSON Web Tokens (JWT) with a beautiful, colorful terminal UI powered by Spectre.Console.
- 🔓 Decode JWT tokens without requiring the signing key
- 🎨 Beautiful color-coded output for header, payload, and signature
- ⏰ Automatic parsing of common JWT claims (exp, iat, nbf)
- ✅ Expiration status checking with visual indicators
- 📋 Pretty-printed JSON output
JWT Decoder takes a JWT token string as input and:
- Decodes the header - Shows the token type and signing algorithm
- Decodes the payload - Displays all claims in formatted JSON
- Shows the signature - Displays the Base64 URL-encoded signature
- Analyzes timestamps - Converts Unix timestamps to readable dates and highlights if the token is expired
This project uses the following NuGet packages:
- Spectre.Console (v0.54.0) - Rich terminal UI framework for beautiful console output
- Spectre.Console.Cli (v0.53.0) - Command-line parsing and execution framework
- Spectre.Console.Json (v0.54.0) - JSON syntax highlighting for terminal output
- .NET 10.0 SDK or later
dotnet builddotnet build -c ReleaseTo create a standalone executable that includes the .NET runtime:
dotnet publish -c Release -r win-x64 --self-contained true -p:PublishSingleFile=trueThe executable will be generated at:
JwtDecoder\bin\Release\net10.0\win-x64\publish\JwtDecoder.exe
For a smaller executable that requires .NET 10.0 to be installed:
dotnet publish -c Release -r win-x64 --self-contained falseTo use the JwtDecoder command from anywhere in your terminal:
-
Open your PowerShell profile:
notepad $PROFILE -
Add the publish directory to your PATH:
$env:Path += ";C:\Privatespace\Labb\JwtDecoder\JwtDecoder\bin\Release\net10.0\win-x64\publish"
-
Save and reload your profile:
. $PROFILE
-
Open System Properties:
- Press
Win + Xand select "System" - Click "Advanced system settings"
- Click "Environment Variables"
- Press
-
Under "User variables" or "System variables", find and select
Path, then click "Edit" -
Click "New" and add the publish directory path:
C:\Privatespace\Labb\JwtDecoder\JwtDecoder\bin\Release\net10.0\win-x64\publish -
Click "OK" to save changes
-
Restart your terminal for changes to take effect
Add an alias to your PowerShell profile:
Set-Alias jwt "C:\Privatespace\Labb\JwtDecoder\JwtDecoder\bin\Release\net10.0\win-x64\publish\JwtDecoder.exe"Once installed, decode a JWT token by passing it as an argument:
JwtDecoder <your-jwt-token>JwtDecoder eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5cNote: If you don't supply a JWT token as an argument, the tool will automatically read it from your clipboard. This feature was contributed by @Fjeddo.
This will display:
- A color-coded header section showing the algorithm and token type
- A formatted payload with all claims
- The signature in Base64 URL encoding
- A table showing important timestamps (expiration, issued at, not before)
The project structure:
Program.cs- Entry point that sets up the CLI applicationDecodeCommand.cs- Main command implementation with JWT decoding logic
This project is provided as-is for educational and development purposes.