Entropy Analyzer

Calculate Shannon entropy for any file in your browser. Get an 0-8 score, per-1KB entropy graph, and byte distribution to spot packed or encrypted data.

By

Advertisement

Free Online Shannon Entropy Calculator for Files

This entropy analyzer measures the Shannon entropy of any file you give it and reports a single score between 0.0 and 8.0, alongside a per-section entropy graph and a byte-frequency distribution. Drop a binary on the page — an executable, a firmware image, a document, an archive, a certificate blob, a memory dump — and the analysis appears in a second or two. The file is read locally with the browser’s FileReader API and analysed in JavaScript on your own machine: nothing is uploaded to a server, nothing is stored, and no account is required. Files up to 50 MB are supported.

It is built for malware analysts triaging an unknown sample, incident responders looking at a suspicious dropper, reverse engineers hunting for embedded payloads, CTF players who need to know whether a blob is compressed or encrypted, and anyone teaching or learning information theory who wants a real file behind the formula.

What Shannon Entropy Actually Measures

Shannon entropy quantifies the average information content — the unpredictability — of a stream of symbols. For a file, the symbols are byte values from 0 to 255, and the entropy in bits per byte is:

H = −∑ p(x) log2 p(x)

where p(x) is the probability of byte value x, estimated as its observed count divided by the total number of bytes. The sum runs over every byte value that actually occurs; values with zero occurrences contribute nothing, which is why the tool skips them rather than evaluating log2(0).

Because there are 256 possible byte values, the theoretical maximum is log2(256) = 8.0 bits per byte, reached only when all 256 values are exactly equally likely. The minimum is 0.0, reached when the file consists of a single repeated byte.

A Worked Example

Take a 1,000-byte file made up of only two byte values: 0x41 (“A”) appearing 750 times and 0x42 (“B”) appearing 250 times.

  • p(0x41) = 750 / 1000 = 0.75; log2(0.75) ≈ −0.4150; contribution = −0.75 × −0.4150 = 0.3113
  • p(0x42) = 250 / 1000 = 0.25; log2(0.25) = −2.0; contribution = −0.25 × −2.0 = 0.5000
  • H = 0.3113 + 0.5000 = 0.811 bits per byte

Change the split to 500/500 and every term becomes −0.5 × log2(0.5) = 0.5, giving H = 1.0 exactly — one bit per byte, because a fair coin flip is worth precisely one bit. Now spread the same 1,000 bytes evenly over all 256 possible values and H climbs to very nearly 8.0. The score is not about how big the file is or what it contains; it is about how evenly the byte values are spread.

How to Use the Entropy Analyzer

  1. Drag a file onto the drop zone, or click Select File and pick one. Any file type works — the tool treats everything as raw bytes.
  2. Read the headline entropy score, shown to two decimal places on the 0.0–8.0 scale and colour-coded: green below 6.0, amber from 6.0 to 7.0, red above 7.0.
  3. Check the assessment badge — normal, suspicious, or encrypted — along with the generated findings and follow-up recommendations.
  4. Scan the entropy distribution chart. The file is split into consecutive 1 KB sections and each section’s entropy is plotted in order, with dashed reference lines at 6.0 and 7.0. Very large files are downsampled to 1,000 evenly spaced points so the graph stays readable.
  5. Look at the byte distribution chart, which ranks the 50 most frequent byte values with their occurrence counts.

Reading the Score

The tool applies these bands, which reflect long-standing practice in binary triage rather than any formal standard:

  • 0.0–3.0 — very low. Padding, sparse files, long runs of zeros, simple bitmaps, or a truncated download. The tool warns that the file may be incomplete or corrupt.
  • 3.0–6.0 — normal. Plain text sits around 4.0–4.7; source code, HTML, CSV, and ordinary uncompressed structured data land here. Native x86 machine code typically falls in the 5.5–6.5 range.
  • 6.0–7.0 — elevated. Mixed content, lightly compressed resources, base64-encoded blobs, or embedded media inside an otherwise ordinary file.
  • 7.0–8.0 — high. Compressed or encrypted data. Above 7.2 the tool labels the file encrypted; between 6.8 and 7.2 it labels it suspicious.

High entropy is not evidence of malice. A ZIP archive, a JPEG, an MP4, a PNG, an installer, a signed certificate bundle, and a random key file all score above 7.0 because compression and encryption both work by removing predictability. Every one of them is perfectly benign. What entropy gives you is a fast, cheap signal about the form of the data, not its intent. Treat a high score as a reason to look closer, never as a verdict.

Where Entropy Analysis Is Genuinely Useful

Detecting Packed or Encrypted Executables

Runtime packers such as UPX, ASPack, PECompact, Themida, and VMProtect compress or encrypt the original code and prepend a small stub that unpacks it in memory at launch. The result is a distinctive shape: a low-to-moderate entropy stub followed by a long high-entropy region. On the section chart this shows up as a flat stretch around 5.0–6.0 that jumps to a plateau near 7.5–8.0 and stays there. A legitimate unpacked binary usually looks more uneven, because import tables, string tables, resources, and relocation data each have their own characteristic entropy. Packing is used by commercial software protection as often as by malware — it is a property to note in a report, not an accusation.

Locating Embedded Payloads and Hidden Data

A short, sharp entropy spike inside an otherwise low-entropy file is one of the most useful findings the section chart produces. An encrypted configuration blob appended to an installer, a compressed second-stage payload glued to the end of a document, or data hidden in the trailing bytes after a valid image all produce a localised jump. The tool also computes the standard deviation of section entropies and warns when it exceeds 2.0, which flags files whose content is unusually mixed. Note the section number where the spike occurs, multiply by 1,024 to get the byte offset, then go and look at those bytes directly — the hex editor is the natural next step, and the file magic number checker will tell you whether the region starts with a recognisable file signature.

Assessing Randomness in Keys and Passwords

Entropy is the standard way to talk about how hard a secret is to guess. Feed a file of generated key material to the analyzer: a well-seeded random key should score extremely close to 8.0, and anything materially below that in a file that is supposed to be pure randomness suggests a broken generator, an encoding layer such as base64 or hex sitting on top of the raw bytes, or repeated blocks. Be careful with the units: password-strength discussion normally uses entropy in bits for the whole secret (roughly log2 of the number of equally likely possibilities), whereas this tool reports bits per byte. A 16-byte key at 8.0 bits per byte carries 128 bits total. For evaluating human-chosen passwords rather than key files, the password strength checker and secure password generator are the right instruments.

Spotting Obfuscated Scripts

Obfuscated JavaScript, PowerShell, or VBScript sits in an awkward middle band. It is still text, so it cannot reach the 7.5+ of true encryption, but long base64 or hex-encoded strings and randomised identifier names push it well above the 4.0–4.7 typical of readable source. Entropy in the 5.5–6.5 range for a plain-text script is a strong hint that something is encoded rather than written. Use it as a filter across a directory of scripts, then decode the suspicious ones with the malware deobfuscator or the base64 encoder and decoder.

Limits You Should Know About

Entropy is a statistic over byte frequencies and nothing more. It is blind to order: shuffling every byte in a file leaves the score completely unchanged, so it cannot distinguish real ciphertext from a well-shuffled ordinary file. It says nothing about which algorithm produced the data. It is unreliable on very small inputs — a 200-byte file simply does not contain enough samples to estimate 256 probabilities, which is why the tool flags files under 1 KB. And because sections are cut at fixed 1 KB boundaries rather than at parsed structure boundaries, a section that straddles the join between two regions averages both. For PE files, per-section entropy computed from the real section table is more precise than fixed chunking; treat this tool as fast triage that tells you where to point a full-featured analyser.

Frequently Asked Questions

What is a good Shannon entropy score for a file?+

It depends entirely on the file type. Around 4.0–4.7 is normal for plain text, 5.5–6.5 for compiled machine code, and 7.5–8.0 for compressed or encrypted content such as ZIP, JPEG, MP4, or a key file. There is no universally “good” number — what matters is whether the score matches what the file claims to be.

Does high entropy mean a file is malware?+

No. Compression and encryption both raise entropy, and both are overwhelmingly used for legitimate purposes. Archives, media files, installers, and certificate bundles all score above 7.0. High entropy means the data is unpredictable, which justifies a closer look but is never on its own an indicator of compromise.

Is my file uploaded anywhere?+

No. The file is read with the browser’s FileReader API and every calculation runs in JavaScript on your own device. Nothing is transmitted, stored, or logged, which makes it safe to analyse samples you are not permitted to send to a third-party service.

Why is the maximum entropy 8 and not 100?+

The unit is bits per byte. A byte can hold 256 distinct values, and log2(256) = 8, so eight bits of information per byte is the ceiling. Tools that report a percentage are simply dividing the same number by 8.

What file size can I analyse?+

Up to 50 MB. Larger files are rejected because the whole buffer is held in browser memory. If you need to check something bigger, analyse a representative slice — the headline score converges quickly on large uniform data.

Why does the chart use 1 KB sections?+

1,024 bytes is large enough to give a stable frequency estimate and small enough to localise a spike to within a kilobyte of the file. Files large enough to produce more than 1,000 sections are downsampled to evenly spaced points purely so the chart renders; the headline entropy is always computed over every byte.

Can entropy tell me which encryption algorithm was used?+

No. Any competent cipher produces output statistically indistinguishable from random, so AES, ChaCha20, and a well-implemented stream cipher all land at essentially 8.0. Identification has to come from headers, key sizes, block-length artefacts, or context.

My executable scores 7.9 — is it packed?+

Very likely packed, compressed, or largely made of embedded compressed resources. Confirm by checking for packer section names such as UPX0 and UPX1 in the section table, looking at the entry point, and examining the import table — a packed binary typically imports only a handful of functions like LoadLibrary and GetProcAddress. Entropy narrows the question; it does not answer it.

Why does a text file score higher after base64 encoding?+

Base64 maps arbitrary data onto 64 printable characters that are used fairly evenly, whereas English text leans heavily on a couple of dozen letters plus the space character. The encoded form is 33% larger and yet more uniform in its byte usage, so the per-byte entropy rises even though no information was added.

What does the byte distribution chart tell me?+

It shows the 50 most frequent byte values and their counts. A near-flat bar chart means the values are used uniformly, which points to compression or encryption. Sharp peaks at 0x00, 0x20 (space), or the ASCII letter range identify padding, text, and structured data respectively — a useful sanity check when the headline score is ambiguous.

Related tools

This tool is provided for informational and educational purposes only. While we strive for accuracy, we make no warranties about the completeness or reliability of results. Results are based on the information you enter and do not constitute a security audit, a formal compliance assessment, or legal advice, and they do not establish that any system or organisation meets a given standard. Coverage of a framework may be partial — check what the tool states it assesses. For anything you intend to rely on, consult a qualified assessor.