JWT Decoder for PHP

Free online jwt decoder with PHP code examples

Working with jwt decoder in PHP? Our free online jwt decoder helps PHP developers format, validate, and process data instantly. Below you will find PHP code examples using firebase/php-jwt so you can achieve the same result programmatically in your own projects.

Try the JWT Decoder Online

Use our free JWT Decoder directly in your browser — no setup required.

Open JWT Decoder

PHP Code Example

<?php
use Firebase\JWT\JWT;
use Firebase\JWT\Key;

$token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";

// Decode without verification (manual base64)
$parts = explode('.', $token);
$header = json_decode(base64_decode($parts[0]), true);
$payload = json_decode(base64_decode($parts[1]), true);

echo "Header: " . json_encode($header, JSON_PRETTY_PRINT) . "\n";
echo "Payload: " . json_encode($payload, JSON_PRETTY_PRINT) . "\n";

Quick Setup

Library: firebase/php-jwt
composer require firebase/php-jwt

PHP Tips & Best Practices

  • firebase/php-jwt is the standard PHP JWT library
  • JWT::decode($token, new Key($key, 'HS256')) for verified decode
  • Manual base64_decode works for reading without verification

Frequently Asked Questions

JWT Decoder in Other Languages

More PHP Tools