<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Your JWT secret is probably too short]]></title><description><![CDATA[Notes from a developer building websites, WordPress projects and browser extensions. Practical guides on web development, JWT and security.]]></description><link>https://jwtsecretkey.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/6af5cb31fe8d94176a2c63fc/9640eedf-e1fd-424f-8854-cc7952277627.png</url><title>Your JWT secret is probably too short</title><link>https://jwtsecretkey.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Wed, 18 Nov 2026 14:32:36 GMT</lastBuildDate><atom:link href="https://jwtsecretkey.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Free JWT Secret Key Generator | Secure HS256, HS384, HS512 Keys Online]]></title><description><![CDATA[HS256 needs a JWT secret of at least 256 bits. Learn why short secrets get cracked and how to generate a safe one with OpenSSL, Node or Python.]]></description><link>https://jwtsecretkey.hashnode.dev/jwt-secret-key-generator</link><guid isPermaLink="true">https://jwtsecretkey.hashnode.dev/jwt-secret-key-generator</guid><category><![CDATA[JWT]]></category><category><![CDATA[Security]]></category><category><![CDATA[webdev]]></category><category><![CDATA[Node.js]]></category><dc:creator><![CDATA[Avada Labs]]></dc:creator><pubDate>Thu, 12 Nov 2026 14:33:47 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6af5cb31fe8d94176a2c63fc/e0a78d01-443c-4c13-9f2a-9cab3be02f57.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hi everyone, this is my first post. I'm a developer who builds websites, WordPress projects and browser extensions, and the topic comes from something I kept running into: JWT secrets that are far too weak.</p>
<p>The rule most people never read</p>
<p>If you sign tokens with HS256, the secret has to be at least as long as the hash output. That is 256 bits, or 32 bytes. This is not a tip, it is in the spec. RFC 7518, section 3.2, says a key of the same size as the hash output or larger MUST be used with HMAC-SHA2 algorithms.</p>
<p>So the same rule applies to the others:</p>
<p>Algorithm Minimum secret HS256 256 bits (32 bytes) HS384 384 bits (48 bytes) HS512 512 bits (64 bytes) Why a short secret is a real problem</p>
<p>A JWT is signed, not encrypted. Anyone who sees a token can copy it and try guessing the secret offline, as many times as they like, with no rate limit. Tools like hashcat have a mode just for this (-m 16500).</p>
<p>If your secret is secret, changeme or your app's name, it falls in seconds to a normal wordlist. Once someone has the secret, they can sign any token they want, including one that says they are an admin.</p>
<p>Length is not the same as strength</p>
<p>This confuses a lot of people. A 64-character hex string looks long, but it only holds 32 bytes of randomness. Those 256 bits are the real strength, not the number of characters. And a long password you typed yourself is still weaker than 32 random bytes, because humans are predictable.</p>
<p>The secret should come from a cryptographically secure random generator, not from your head.</p>
<p>How to generate one</p>
<p>Pick whatever you already have installed:</p>
<p>bash</p>
<h1>OpenSSL</h1>
<p>openssl rand -hex 32 js // Node.js require('crypto').randomBytes(32).toString('hex'); python</p>
<h1>Python</h1>
<p>import secrets secrets.token_hex(32)</p>
<p>All three give you 256 bits of randomness.</p>
<p>What to do with it</p>
<p>Put it in an environment variable and read it from there:</p>
<p>bash JWT_SECRET=your-generated-value Never commit it to Git. If it was ever committed, treat it as leaked and replace it. Use a different secret for each environment (development, staging, production). Plan for rotation. Changing the secret logs everyone out, so decide how you will handle that before you need to. Two more mistakes worth fixing</p>
<p>Pin the algorithm when you verify. Do not let the token decide how it should be checked:</p>
<p>js jwt.verify(token, process.env.JWT_SECRET, { algorithms: ['HS256'] });</p>
<p>Decoding is not verifying. Reading the header and payload of a token tells you nothing about whether it is real. Only checking the signature with your secret does.</p>
<p>A small tool I made for this</p>
<p>I got tired of pasting secrets and tokens into random websites, so I built a free tool that generates HS256, HS384 and HS512 secrets and decodes tokens, all inside your browser with the Web Crypto API. Nothing is uploaded: <a href="http://jwtsecretkey.com">jwtsecretkey.com</a></p>
<p>If you use something different, that is fine. The point is the same: 32 random bytes, kept out of your repo.</p>
<p>What is the weakest JWT secret you have ever found in a real project? I would like to hear it.</p>
]]></content:encoded></item></channel></rss>