Online PHP & HTML Compiler

Write PHP mixed with HTML, press Run and see the rendered page and the raw output side by side. PHP 8.3 runs right here in your browser, so your code never leaves your device.

  • 100% free
  • No sign-up
  • Runs in your browser

Write PHP & HTML

Tab indents and Shift+Tab outdents. To leave the editor with the keyboard, press Esc and then Tab.

  • PHP 8.3 runs in your browser using WebAssembly. Your code is not sent to any server.
  • No database, no network access (curl or URLs in file_get_contents) and no saved files. Anything you write to disk is kept in memory only.
  • The first run downloads PHP (about 3.3 MB). After that, runs start straight away.

Powered by php-wasm (Apache-2.0, notice) and PHP 8.3 (PHP License 3.01). This product includes PHP software, freely available from php.net/software.

Result

Press Run to see the rendered page and the raw output. Errors and warnings appear here with their line numbers.

About the tool

How the Online PHP & HTML Compiler works

The Online PHP & HTML Compiler lets you write PHP mixed with HTML and run it straight away. Type or paste your code, press Run (or Ctrl+Enter, ⌘+Enter on a Mac) and the result appears in two views: Preview shows the page as a browser would render it, and Output shows the exact text PHP produced. A sample page with a loop, a function, an array and the date gets you started.

PHP 8.3 runs in your own browser, compiled to WebAssembly with the open-source php-wasm project. Your code is never uploaded or run on our server. The first run downloads PHP (about 3.3 MB); after that, runs start instantly. PHP works in a separate background thread, so if a script loops forever you can press Stop and carry on.

Errors and warnings are listed above the result with their line numbers, and clicking one jumps to that line in the editor. Because PHP runs inside your browser, there is no database, no internet access from PHP (no curl, and file_get_contents can't open URLs) and files you write are kept in memory only. Some extensions, such as mbstring, GD, MySQL and SQLite, are not included. It is ideal for learning PHP, testing a snippet or checking how a template renders.

Frequently asked questions

Is my PHP code sent to a server?

No. PHP 8.3 has been compiled to WebAssembly and runs inside your browser, on your own device. Your code and its output are never uploaded, and nothing runs on our server. Your last code is saved only in your own browser so it is still there next time.

Which PHP version does it use?

PHP 8.3 (currently 8.3.11), built with the open-source php-wasm project. The exact version is shown under the result after each run, and you can check it in your code with echo PHP_VERSION; or phpversion().

Can I connect to a database or call an API?

No. The browser version of PHP has no database server and no internet access. mysqli, PDO for MySQL and SQLite, and curl are not available, and file_get_contents() can't open http:// or https:// addresses. Files you create with file_put_contents() are kept in memory and are gone when you close the page.

Why are some functions or extensions missing?

To keep the download small and the browser safe, this build includes the core of PHP plus common extensions such as date, json, pcre, ctype, bcmath, calendar, filter, hash, session, SPL, Reflection and tokenizer. Extensions that need a server, the network or extra libraries, such as mbstring, GD, intl, openssl, zlib, curl and database drivers, are not included, so calling their functions gives a "Call to undefined function" error.

What happens if my code runs forever?

PHP runs in a background thread, so the page stays responsive. If a script takes long, you will see a message, and the Stop button ends it immediately. PHP then restarts on your next run without downloading again. set_time_limit() and max_execution_time have no effect in the browser, so use Stop instead.

Keep exploring
  • Free
    Developer

    Word to HTML Converter

    Turn Word documents (.docx) or text pasted from Word into clean HTML or Markdown for any website, CMS or email.

    • DOCX to HTML
    • Markdown
    • Paste from Word
  • Free
    SEO

    Open Graph & Social Preview Checker

    Preview how your page looks when shared on Facebook, X, LinkedIn, WhatsApp and Slack, and fix your Open Graph tags.

    • Open Graph
    • Twitter Card
    • Link preview
  • Free
    Design

    Color Palette from Image

    Extract the main colours from any image and copy them as HEX, RGB or HSL, or export CSS, Tailwind and JSON.

    • HEX codes
    • Color picker
    • Tailwind
For makers

Have an AI Tool?

Submit your AI tool and help others discover it.