A source code viewer for reading code anywhere
Code in a plain text window is a gray wall of characters. Syntax highlighting colors keywords, strings, comments and numbers differently, so the structure jumps out and mistakes like an unclosed string become obvious. This source code viewer adds highlighting and line numbers to any snippet or file, which is handy on a machine without an IDE, for reviewing an email attachment, or when a colleague asks you to "look at line 42".
Supported languages
JavaScript, TypeScript, HTML, XML, CSS, PHP, Python, Java, C, C++, C#, Go, Rust, Ruby, Kotlin, Swift, SQL and shell scripts. When the language is left empty, the viewer makes a quick guess from the first lines: <?php means PHP, a leading < means HTML, def or import suggests Python, SELECT suggests SQL and selector { suggests CSS. Everything else is treated as JavaScript-like code. Pick the language manually if the guess is wrong.
Example
<?php
namespace App\Http\Controllers;
use App\Models\Post;
class PostController extends Controller
{
public function show(Post $post)
{
return view('posts.show', ['post' => $post]);
}
}With auto-detect, this is recognized as PHP; keywords such as namespace, class and return are colored, strings stand out and each line is numbered.
Options
- Language – auto-detect or choose one of the supported languages.
- Theme – light or dark, whichever is easier on your eyes.
- Line numbers – on by default, essential when discussing code with others.
The status line shows the number of lines and characters, a quick way to check a file's size.
When a viewer beats an editor
A viewer shows the code read-only, so you cannot accidentally change a file you only meant to read. It also opens instantly without project setup, which is ideal for quick reviews during a call or on a device where you do not have your usual tools.
Viewing code safely
The viewer only displays code; it never executes it. That makes it a safe way to inspect scripts you received, for example a shell script someone asked you to run. Read it first, and do not run commands you do not understand.
Related tools
- Need colored HTML to paste into a blog or email? The code syntax highlighter exports self-contained HTML.
- Want to edit, not just read? Open the file in the online code editor.
- Messy formatting? Clean it up first with a formatter such as the PHP formatter or Python formatter.
Files are read by your browser and never uploaded.