Java to Kotlin Converter
Translate a subset of Java — classes, methods, variables, loops, println — into idiomatic Kotlin.
Supported: System.out.println, variable declarations (with var/val), methods, classes, main, C-style and enhanced for loops, and new. Constructors, lambdas, generics, and static members need a manual pass — always review.
Examples
Method with a return type
public int square(int n) {
return n * n;
}fun square(n: Int): Int {
return n * n
}Modifiers are dropped, the return type moves after the colon, and `int` becomes `Int`. The trailing semicolon is removed.
About this tool
The Java to Kotlin Converter rewrites simple Java into idiomatic Kotlin. Both languages are brace-based, so the structure carries over and only statement-level changes are needed: System.out.println becomes println, `int`/`boolean`/`String` declarations become `var` or `val`, Java methods become `fun` with Kotlin parameter and return types, and `new Foo()` becomes `Foo()`.
C-style and enhanced for loops map to Kotlin ranges and for-in, and `final` declarations become `val`. The converter runs entirely in your browser — nothing is uploaded. It targets a deliberate subset; constructors, generics, lambdas, and static members are flagged for a manual review.
How to use
Paste a Java snippet
Load the sample or paste your own class, method, or small program.
Read the Kotlin output
The right-hand pane updates live; warnings flag anything outside the supported subset.
Copy and review
Copy the Kotlin and review the flagged constructs (static members, generics) before shipping.
Use cases
Porting a Java utility
Bootstrap a Kotlin version of a small Java class without rewriting every line by hand.
Learning Kotlin
See how a familiar Java snippet reads in Kotlin by converting one construct at a time.
Common mistakes
Mistake:Trusting the output for complex generics.
Fix:Generic type arguments and method references are not handled — review and fix those by hand.
Mistake:Forgetting static members need a companion object.
Fix:Kotlin has no static; the converter warns and you move the member into a companion object.
Frequently asked questions
Related guides
Java to Kotlin: A Practical Conversion Guide
How a simple Java class maps to idiomatic Kotlin — println, var/val, fun, and for-in — and where a hand-rolled converter needs a manual review.
C# to VB.NET: Converting Across the .NET Language Divide
How C# braces and types map to VB.NET keyword blocks (Class/End Class, Sub/Function, If...Then/End If) and where you still need to finish by hand.
References & standards
Related tools
Base64 Toolbox
Professional Base64 workspace for text, files and images with Base64URL, MIME, Data URI, strict validation, image preview and ready-to-use snippets.
C# to VB.NET Converter
Convert a subset of C# — classes, methods, variables, loops — into VB.NET
CSV to Chart
Paste or upload CSV data and generate bar, line, pie, or doughnut charts. Export as PNG.
CSV to JSON Converter
Paste CSV data and convert it to pretty-printed JSON instantly — supports custom delimiters, header row toggling, and value trimming.
CSV to Markdown Converter
Convert CSV to a Markdown table and Markdown tables back to CSV
CSV to SQL Converter
Generate SQL INSERT statements from CSV data