CLASS TXT
File conversion

Convert CLASS to TXT

QUICK ANSWER
Is it possible to convert CLASS to TXT?
Yes - CLASS converts to TXT.

Run javap -c -p MyClass > MyClass.txt to save bytecode disassembly to a text file with no extra download beyond the JDK. For reconstructed Java source instead of mnemonics, drag the .class into JD-GUI or run CFR. Opening a .class directly in a text editor produces unreadable binary.

Also to TXT: RTF · KKSRC · HVE

On this page

Tested on macOS, Windows & Linux
Last verified Oct 2026

More free converters

HEIC, PNG, WEBP, MP3 and more - every tool here is free.

Open the toolbox

Why convert CLASS to TXT?

A .class file is compiled binary bytecode and cannot be read as text without processing. Developers disassemble or decompile to .txt to inspect what a class does when the original .java source is unavailable, to diff two compiled versions, or to document a library's public API.

How to convert CLASS to TXT

javap (JDK) FREE

Run javap -c -p MyClass in a terminal to print bytecode instructions, then redirect to a file with > MyClass.txt. Add -verbose for constant pool and class version details.

JD-GUI OPEN-SOURCE

Drag the .class file onto JD-GUI and the reconstructed Java source appears in the editor. Use File > Save All Sources to export as a .java file (plain text) and rename to .txt if needed.

CFR OPEN-SOURCE

Run java -jar cfr.jar MyClass.class > MyClass.txt to redirect reconstructed Java source directly to a text file.

About these formats

Quality & what to watch

  • A .class file starts with the magic bytes 0xCAFEBABE - opening it in a text editor shows binary garbage, not readable content.
  • javap output is bytecode mnemonics (invokevirtual, aload, etc.), not Java source; use JD-GUI or CFR if you need source-like output.
  • Add -verbose to javap to include the class file major version, constant pool, and attribute tables in the output.

Frequently asked questions

What is the difference between javap output and decompiler output?
javap shows bytecode instructions (mnemonics); JD-GUI and CFR reconstruct Java source syntax - both produce plain text but differ significantly in readability.
Do I need to install anything extra to use javap?
javap ships with every JDK installation; if you have Java development tools installed, it is already available.
Can I convert a .class file to .txt without installing Java?
No - javap, JD-GUI, and CFR all require Java to run, so a JDK or JRE installation is necessary.