Online Octave Compiler
Run Octave online with GNU Octave 9.4, which runs most MATLAB code. Write a script with matrices, loops and functions, press Run, and see what it prints beside your code, with errors shown by line. Scripts can read input with input as they run.
How to run Octave code online
- This page opens with Octave selected, so you can start typing straight away.
- Write your code in the editor, or open files from your computer: single files, or a whole project as a .zip.
- Press Run, or Ctrl+Enter. The output appears in the panel beside the editor, and when the program asks for input you type it there and press Enter.
- Share a copy with a link, or save your files to your computer.
Octave 9.4 on Online IDE
- Your script runs with GNU Octave 9.4, which runs most MATLAB code.
- input('Prompt: ', 's') shows its prompt and reads a line as text; without 's', Octave evaluates what is typed.
- printf and disp write to the output panel; end a statement with a semicolon to stop Octave printing its result.
- Plots cannot be shown, as scripts run without a display, and Octave Forge packages are not installed.
Example: a Octave program that reads input
n = str2double(input('Enter a whole number: ', 's'));
if isfinite(n) && n > 0 && n == fix(n)
d = 1:n;
printf('Divisors of %d: %s\n', n, mat2str(d(mod(n, d) == 0)));
else
disp('Please enter a whole number above zero.');
end
Features of this tool
- Simple and fastA clean, lightweight editor that opens instantly.
- Powered by AceThe Ace code editor, with syntax highlighting, autocompletion and bracket matching.
- Interactive programsType input into the terminal while your program runs.
- Several filesWork in tabs, open files or a .zip from your computer, and save the project back to disk.
- Made for learningHelpful for beginners to learn and practice programs.
- Light and dark themesPlus 39 editor themes, a choice of coding fonts, and Vim, Emacs or VS Code keys.
- Keep your outputCopy or download the program output in one click.
- Share by linkSave your code in the cloud and open it anywhere.
Frequently asked questions
Is Octave the same as MATLAB?
Octave runs most MATLAB scripts unchanged, including matrices, functions and control flow. MATLAB toolboxes and Simulink are not available.
Can an Octave script read input?
Yes. input('Prompt: ', 's') reads a line as text, and str2double turns it into a number. Type into the output panel while the script waits and press Enter.
Can I plot graphs?
No. Scripts run without a display, so figure and plot cannot draw. Print the numbers instead.
Can I define functions in my script?
Yes. Start the script with a statement other than function, such as 1;, then define each function before the code that calls it.
Contact us
For any feedback, queries or issues, please feel free to contact us or write to . We value your input and are committed to providing the best possible experience for our users.