Code Viewer
Open source code and text files with syntax highlighting, search and line numbers.
How to use the Code Viewer
- 1Drop any code or text file: JavaScript, Python, Java, CSS, logs and more.
- 2The language is detected from the file name, or pick it yourself.
- 3Search, fold and wrap lines, then copy or download.
About Code Viewer
The Code Viewer opens source code and plain text files with syntax highlighting, line numbers, code folding and search. The language is detected from the file name or extension and covers more than 40 languages and formats, including JavaScript, TypeScript, Python, Java, C, C++, C#, Go, Rust, PHP, Ruby, Kotlin, Swift, shell and PowerShell scripts, Dockerfiles, INI and .env files, Nginx configs, diffs and LaTeX. If the guess is wrong, choose the language yourself.
You can switch line wrapping on, change the font size, lock the file as read-only or edit it, then copy the text or download it again. Log files get their own highlighting for timestamps, ERROR, WARN and INFO levels, which makes long server logs easier to scan. HTML files can be previewed rendered in an isolated frame where their scripts don't run, and JSON, YAML, XML, TOML and SQL files are also checked for syntax errors.
This online code viewer is useful when you need to read a file on a computer without an editor installed, look at a log someone sent you, or share a quick look at a script. Files up to 200 MB open here; binary files are detected and pointed to the Hex Viewer.
Frequently asked questions
How do I open a .log file?
Drop the .log file onto the viewer. Timestamps and levels like ERROR and WARN are highlighted, and Ctrl+F searches the whole file.
Can I see an HTML file rendered?
Yes. HTML files get a Preview view next to the source. The page is shown in a sandboxed frame, so scripts in it never run and remote images load only if you allow them.
Why does my file open as binary?
The viewer treats a file as binary when its first few thousand characters contain null bytes, which text files don't have. Images, executables and compressed files fall into this group; open them in the Hex Viewer instead.
Can I edit the code and save it?
Yes. Editing is on by default; when you're done, copy the text or download it under the original file name. Switch on read-only mode to avoid accidental changes.
Guides
More in File Viewers
Drop any file to look inside it, with the right viewer picked for you.
Browse JSON as a collapsible tree and find syntax errors down to the line.
Check YAML for indentation and syntax errors and explore it as a tree.