HTML <applet> Tag

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 2 Examples
Obsolete

What You’ll Learn

By the end of this tutorial, you’ll understand legacy Java applet markup and what to use instead in modern web development.

01

Original Syntax

How <applet> embedded Java programs with code, width, and height.

02

Key Attributes

Understand codebase, archive, alt, and <param> configuration.

03

Historical Use Cases

Games, charts, animations, and interactive demos before JavaScript matured.

04

Obsolete Status

Why HTML5 removed <applet> and discontinued the Java Plugin.

05

Modern Alternatives

Replace applets with JavaScript, Canvas, WebGL, CSS, and WebAssembly.

06

Legacy Maintenance

Know when you’ll encounter applet in old codebases and how to migrate away.

What Is the <applet> Tag?

The applet element (<applet>) was used to embed a Java applet—a compiled Java program (.class file) that executed inside the browser via the Java Plugin. Applets enabled interactive animations, games, charts, and calculators before JavaScript matured.

⚠️
Obsolete in HTML5

The <applet> tag is removed from the HTML5 specification and no longer supported by modern browsers. Java applets required a browser plugin that has been discontinued. Do not use this tag in any new project.

As of HTML5, the tag is obsolete. Browsers have removed Java Plugin support due to security vulnerabilities and the availability of safer, native web technologies like JavaScript and HTML5 Canvas.

📝 Syntax

The syntax involved specifying attributes like code, width, and height to define the applet’s properties, with fallback content inside the tag:

syntax.html
<!-- Legacy Java applet syntax -->
<applet code="YourAppletClass.class" width="300" height="200">
  <!-- Alternative content if the applet cannot be displayed -->
  Your browser does not support the <code><applet></code> tag.
</applet>

Syntax Rules

  • code points to the compiled Java .class file to execute.
  • width and height set the display area in pixels.
  • Fallback content inside the tag displays when the applet cannot run (all modern browsers).
  • <param> child elements pass name/value pairs to the Java program.

⚡ Quick Reference

AttributeCode SnippetPurpose
codecode="MyApplet.class"Path to the compiled Java class file
width / heightwidth="300" height="200"Dimensions of the applet display area
codebasecodebase="/applets"Base directory for class files and archives
archivearchive="app.jar"Comma-separated list of JAR archives
altalt="Java animation demo"Short description when the applet cannot load
<param><param name="speed" value="fast">Passes configuration values to the applet

🧰 Attributes

The <applet> tag supported several attributes for configuring the embedded Java program:

code Required

Specifies the applet’s compiled Java class file (e.g. MyApplet.class).

code="Animation.class"
width / height Required

Defines the width and height of the applet display area in pixels.

width="400" height="300"
codebase Optional

Base URL or directory path for the applet’s class files and archives.

codebase="/applets"
archive Optional

One or more JAR files containing the applet and its dependencies.

archive="app.jar,lib.jar"
alt A11y

Alternative text for browsers that cannot display the applet.

alt="Java animation demo"
<param> Child

Child elements that pass name/value configuration to the Java program.

<param name="color" value="blue">

All applet attributes are historical only. The entire element is obsolete in HTML5.

Examples Gallery

Historical Java applet patterns with copy-ready code. Modern browsers show only the fallback content inside the tag.

Basic Syntax

The simplest historical form: specify the Java class, dimensions, and fallback content for browsers without applet support (which today means all modern browsers).

basic-applet.html
<applet code="YourAppletClass.class" width="300" height="200">
  Your browser does not support the <code><applet></code> tag.
</applet>
Try It Yourself

📚 Common Use Cases (Historical)

In the past, the <applet> tag was widely used for integrating Java applets into web pages—animations, data visualizations, educational demos, and games. Due to security concerns and the evolution of web technologies, Java applets have become outdated.

Parameters & codebase

Developers passed configuration to applets using <param> child elements and set the class file location with codebase and archive attributes.

applet-parameters.html
<applet code="Animation.class" codebase="/applets" width="400" height="300" alt="Java animation demo">
  <param name="speed" value="fast">
  <param name="color" value="blue">
  Java applets are no longer supported in modern browsers.
</applet>
Try It Yourself

🚫 Deprecated Status

The <applet> tag is deprecated and obsolete. It is no longer recommended for use in modern web development.

Security Critical

Java applets were a frequent attack vector and major security vulnerability in browsers.

Plugin dependency Removed

Required a separate Java browser plugin, now discontinued in all major browsers.

Performance Issue

Slower startup and higher memory use compared to native JavaScript and WebAssembly.

Alternatives Modern

JavaScript, Canvas, WebGL, CSS animations, and WebAssembly are safer and faster.

🚀 Modern Alternatives

Given the obsolete status of <applet>, use these technologies for interactive web content today:

JavaScript Native

DOM manipulation, events, and application logic without browser plugins.

document.querySelector(...)
Canvas / WebGL Graphics

2D drawings, games, and 3D visualizations directly in the browser.

<canvas id="game"></canvas>
CSS Animations Motion

Transitions and keyframe animations without Java or plugins.

@keyframes fadeIn { ... }
WebAssembly WASM

Near-native performance for compute-heavy browser applications.

WebAssembly.instantiate(...)

🧐 Considerations

If you encounter <applet> in legacy code, plan to remove or replace it. Modern web development relies on JavaScript, HTML5, and CSS for creating dynamic and interactive content. For maintaining old sites, document the applet functionality and rebuild with current web APIs.

🧠 How Java Applets Worked

1

Browser loads the page

The parser encounters <applet> and reads code, width, height, and param values.

Markup
2

Java Plugin starts

The browser plugin downloaded and executed the .class or .jar file inside a sandboxed Java runtime.

Plugin
3

Applet renders interactively

The Java program drew graphics and handled user input within the allocated width and height.

Runtime
=

Today: use web-native tech

JavaScript and HTML5 APIs deliver the same interactivity without plugins. The <applet> tag exists only in web history and legacy maintenance.

Browser Support

The <applet> tag has no functional support in modern browsers. All major browsers have removed Java Plugin support. The tag should be treated as non-functional in modern environments.

Obsolete · Plugin removed

Non-functional in modern browsers

All major browsers have removed Java Plugin support. Modern browsers show only the fallback content inside the <applet> tag—the Java program itself will not execute.

0% Modern support
Google Chrome Plugin removed · Obsolete
Not supported
Mozilla Firefox Plugin removed · Obsolete
Not supported
Apple Safari Plugin removed · Obsolete
Not supported
Microsoft Edge Plugin removed · Obsolete
Not supported
Internet Explorer Legacy plugin only · EOL
Legacy only
Opera Plugin removed · Obsolete
Not supported

Why applets were removed

Security, performance, and native web technology maturity drove universal deprecation.

🔒
Security vulnerabilities Java applets were a frequent attack vector in browsers
Critical
JavaScript & Canvas Native web APIs replaced applets for interactivity
Replacement
<applet> tag 0% modern support

Bottom line: Learn <applet> for legacy maintenance only. Use JavaScript, Canvas, or WebAssembly for all new interactive content.

Conclusion

While the <applet> tag played a significant role in early web development, its deprecated status makes it unsuitable for modern web projects.

Developers should adopt contemporary technologies—JavaScript, HTML5 Canvas, CSS, and WebAssembly—to create dynamic and engaging web content without relying on discontinued browser plugins.

💡 Best Practices

✅ Do

  • Use JavaScript and HTML5 APIs for all new interactive content
  • Replace legacy <applet> tags when maintaining old sites
  • Provide meaningful fallback content inside applet tags (for historical reference)
  • Learn applet syntax only to understand legacy HTML you may encounter
  • Consider WebAssembly for performance-critical browser applications

❌ Don’t

  • Use <applet> in any new HTML5 project
  • Depend on the Java browser plugin—it is discontinued everywhere
  • Assume applets will run in modern Chrome, Firefox, Safari, or Edge
  • Ignore security risks when auditing legacy pages with applets
  • Confuse <applet> with <embed> or <object> for modern media

Key Takeaways

Legacy Knowledge

Six truths about the obsolete <applet> tag

Understand the history, then build with modern web-native technologies.

6
Core concepts
📝 02

Core Attributes

code, width, and height configured the embedded program.

Reference
03

Removed from HTML5

The tag is obsolete and not valid in conforming HTML5 documents.

Obsolete
🔒 04

Plugin Discontinued

Java Plugin removed from Chrome, Firefox, Safari, Edge, and Opera.

Security
05

Use JavaScript Instead

Canvas, WebGL, CSS, and WebAssembly replace applets for interactivity.

Migration
🚀 06

Learn, Don’t Use

Study for legacy code only—never use in new HTML5 projects.

Guidance

❓ Frequently Asked Questions

The <applet> element embedded Java applets—compiled Java programs that ran inside the browser via the Java Plugin for interactive content.
No. It is obsolete and removed from the HTML5 specification. Modern browsers no longer support Java applets.
JavaScript, HTML5 Canvas, WebGL, CSS animations, and WebAssembly provide safer, faster interactive content without browser plugins.
Security vulnerabilities, plugin dependency, poor performance, and the maturity of native web technologies led to widespread deprecation.
Modern browsers show only the fallback content inside the <applet> tag. The Java program itself will not execute.

Build with Modern JavaScript

Skip obsolete applets. Practice modern HTML and JavaScript in the live editor.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful