<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Cheng</title>
    <description>The latest articles on DEV Community by Cheng (@forglydev).</description>
    <link>https://dev.to/forglydev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3961300%2Ff0dcb23c-2937-43c4-8548-642106fc5a86.jpg</url>
      <title>DEV Community: Cheng</title>
      <link>https://dev.to/forglydev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/forglydev"/>
    <language>en</language>
    <item>
      <title>JWT Explained: What's Actually Inside That Token (with a free decoder)</title>
      <dc:creator>Cheng</dc:creator>
      <pubDate>Sun, 31 May 2026 15:17:31 +0000</pubDate>
      <link>https://dev.to/forglydev/jwt-explained-whats-actually-inside-that-token-with-a-free-decoder-16ac</link>
      <guid>https://dev.to/forglydev/jwt-explained-whats-actually-inside-that-token-with-a-free-decoder-16ac</guid>
      <description>&lt;p&gt;If you've ever worked with auth, you've seen a JWT — a long string like &lt;code&gt;eyJhbGci...&lt;/code&gt; split into three parts by dots. It looks cryptic, but it's surprisingly simple once you see inside.&lt;/p&gt;

&lt;h2&gt;
  
  
  A JWT has three parts
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;header.payload.signature&lt;/code&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Header&lt;/strong&gt; – tells you the signing algorithm, e.g. &lt;code&gt;{"alg":"HS256","typ":"JWT"}&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Payload&lt;/strong&gt; – the claims (the actual data), e.g. &lt;code&gt;{"sub":"123","name":"John","iat":1516239022}&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Signature&lt;/strong&gt; – verifies the token wasn't tampered with (needs the secret/key)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The header and payload are just &lt;strong&gt;Base64url-encoded JSON&lt;/strong&gt; — not encrypted. That means anyone can read them. So:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ Never put secrets in a JWT payload. It's signed, not hidden.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Decoding one yourself
&lt;/h2&gt;

&lt;p&gt;You can decode the payload in the browser console:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[,&lt;/span&gt; &lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;atob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or, if you just want to paste a token and instantly see the header + payload (without sending it to a server), I built a free decoder that runs entirely in your browser: &lt;a href="https://forgly.dev/tools/jwt-decoder" rel="noopener noreferrer"&gt;https://forgly.dev/tools/jwt-decoder&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Decoding ≠ verifying
&lt;/h2&gt;

&lt;p&gt;Reading a JWT is trivial. &lt;strong&gt;Trusting&lt;/strong&gt; it is not — you must verify the signature on your server with the secret/public key before relying on any claim. Decoding just lets you inspect what's there.&lt;/p&gt;

&lt;p&gt;That's the whole mental model: a JWT is a readable, signed envelope — not a locked box.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>security</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
